Spaces:
Sleeping
Sleeping
Update README.md
Browse files12345678910111213---title: Problem Decoderemoji: πcolorFrom: purplecolorTo: indigosdk: gradiosdk_version: 6.14.0python_version: '3.13'app_file: app.pypinned: false---Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157---title: Intern Problem Solver APIemoji: π§colorFrom: bluecolorTo: indigosdk: dockerpinned: falseapp_port: 7860---# Intern Problem-Solving APIA multi-agent FastAPI backend that helps interns understand real-world problems and build structured thinking. Five specialized agents run in sequence β each feeding context to the next β to deliver a complete analysis with actionable next steps.## Agent Pipeline```Input β [1] Problem Analyst β [2] Root Cause β [3] Solutions β [4] Action Plan β [5] Thinking Coach```| Agent | Job ||-------|-----|| Problem Analyst | Identifies core problem, stakeholders, known vs unknown || Root Cause Analyst | Breaks down WHY the problem exists across technical, process, and people dimensions || Solution Brainstorm | Generates 7 diverse ideas β quick wins, medium-term, strategic, and unconventional || Action Planner | 3 concrete next steps the intern can start immediately || Thinking Coach | Honest feedback on the intern's framing β are they a problem solver or task executor? |---## Endpoints| Method | Endpoint | Returns ||--------|----------|---------|| `GET` | `/` | API info and endpoint list || `GET` | `/health` | Health check || `POST` | `/analyze` | Full analysis as JSON || `POST` | `/analyze/stream` | Server-sent events β streams each agent live || `POST` | `/analyze/pdf` | Downloadable PDF report |---## Request BodyAll three `POST` endpoints accept the same JSON body:```json{"content": "Paste your problem, transcript, or blocker here","intern_name": "Your Name","intern_role": "AI Developer Intern","intern_goal": "What you are trying to achieve this week"}```| Field | Required | Default ||-------|----------|---------|| `content` | β Yes | β || `intern_name` | No | `"Intern"` || `intern_role` | No | `"AI Developer Intern"` || `intern_goal` | No | `""` |---## Response β `/analyze````json{"problem_statement": "## Core Problem\n...","root_causes": "## Root Cause Analysis\n...","solutions": "## Solution Ideas\n...","action_plan": "## Your Next Steps\n...","thinking_feedback": "## Thinking Feedback\n..."}```---## Response β `/analyze/stream`Server-sent events. Each event is a JSON object on a `data:` line:```data: {"event": "agent_start", "agent": "analyst", "label": "Problem Analyst"}data: {"event": "token", "agent": "analyst", "text": "## Core Problem\n"}data: {"event": "agent_done", "agent": "analyst"}data: {"event": "done"}```Event types:| Event | Fields | Meaning ||-------|--------|---------|| `agent_start` | `agent`, `label` | Agent has started running || `token` | `agent`, `text` | Next streamed token from this agent || `agent_done` | `agent` | Agent finished || `done` | β | All 5 agents complete |---## Setup### Environment VariableSet this as a **Secret** in your HuggingFace Space settings:```ANTHROPIC_API_KEY=sk-ant-...```Do not put it in the Dockerfile or commit it to the repo.### Files Required```main.pyrequirements.txtDockerfileREADME.md```---## Local Development```bash# Install dependenciespip install -r requirements.txt# Run with your API keyANTHROPIC_API_KEY=sk-ant-... uvicorn main:app --reload --port 7860```API docs available at `http://localhost:7860/docs` once running.---## ClientThe frontend (`client.html`) is a standalone HTML file β no build step, no framework. Host it anywhere: a second HF Space (static SDK), GitHub Pages, or just open it locally in a browser.Point the **Backend API URL** field in the client to this Space's URL:```https://your-username-intern-problem-solver.hf.space```---## Stack- **FastAPI** β API framework- **Anthropic SDK** β claude-sonnet-4-6 for all agents- **ReportLab** β PDF generation- **Uvicorn** β ASGI server
README.md+152-8