2.4 KiB
2.4 KiB
Story 2.6: FastAPI-Run-Endpunkte implementieren
Status: done
Story
Als API-Nutzer,
möchte ich POST /api/councils/run und GET /api/councils/run/{run_id},
so dass ich einen Council-Run starten und sein Ergebnis abrufen kann.
Acceptance Criteria
POST /api/councils/run→202 Acceptedmitrun_id, asynchroner HintergrundausführungGET /api/councils/run/{run_id}→status,final_draftbei abgeschlossenem Run- Unbekannte
run_id→404 Not Found - Leeres
input_topic→ Validierungsfehler (422) GET /api/health→{"status": "ok", "service": "CouncilOS API"}- FastAPI-App registriert alle Router unter
/api-Prefix
Tasks / Subtasks
- Task 1:
api/routes.pymit Run-Endpunkten (AC: 1–4)- Subtask 1.1:
CouncilRunRequestPydantic-Modell - Subtask 1.2:
POST /councils/runmitBackgroundTasks - Subtask 1.3:
GET /councils/run/{run_id}mitrun_store.get() - Subtask 1.4:
GET /health(AC: 5)
- Subtask 1.1:
- Task 2:
api/run_store.pyIn-Memory-Run-Store (AC: 2, 3) - Task 3:
main.pyFastAPI-Entrypoint (AC: 6)- Subtask 3.1: Router-Registrierung mit
/apiPrefix - Subtask 3.2: CORS-Middleware
- Subtask 3.1: Router-Registrierung mit
- Task 4: Unit-Tests für alle Endpunkte (AC: 1–5)
Dev Notes
BackgroundTasks.add_task()für nicht-blockierende LangGraph-Ausführungrun_store.create(run_id, input_topic)→ status: "pending"- Test-Setup:
AsyncClient(app=app)viahttpxohne echten LangGraph-Lauf
Project Structure Notes
backend/api/routes.pybackend/api/run_store.pybackend/main.pybackend/tests/test_api.py
References
- [Source: _bmad-output/planning-artifacts/architecture.md#REST-Endpunkte]
- [Source: _bmad-output/planning-artifacts/architecture.md#ADR-002]
Dev Agent Record
Agent Model Used
Amelia (💻 BMAD Dev Agent)
Completion Notes List
run_storeist ein einfachesdictmit Thread-Safe-Operationen (GIL ausreichend für MVP).BackgroundTaskserlaubt sofortige202-Antwort ohne auf LangGraph zu warten.- CORS:
allow_origins=["*"]für lokale Entwicklung; in Produktion einschränken.
File List
backend/api/__init__.pybackend/api/routes.pybackend/api/run_store.pybackend/main.pybackend/tests/test_api.py