Spaces:
Runtime error
Runtime error
Download src/backend/routes/trace.py from HAK-Tech/ciro-backend: direct link, hf CLI and curl.
- Browser
- Download file 750 Bytes
-
https://huggingface.co/spaces/HAK-Tech/ciro-backend/resolve/main/src/backend/routes/trace.py
- Command line
-
hf download hf://spaces/HAK-Tech/ciro-backend/src/backend/routes/trace.py
-
curl -L -o trace.py https://huggingface.co/spaces/HAK-Tech/ciro-backend/resolve/main/src/backend/routes/trace.py
750 Bytes
| """ | |
| GET /api/crisis/{crisis_id}/trace — agent trace endpoint. | |
| Returns the full AgentTrace for a given crisis_id. Polled by the mobile app | |
| to render the live reasoning timeline on AgentTraceScreen. | |
| """ | |
| from fastapi import APIRouter, HTTPException | |
| from backend.services.trace import get_trace | |
| router = APIRouter(prefix="/api/crisis", tags=["Crisis"]) | |
| async def get_crisis_trace(crisis_id: str) -> dict: | |
| """Return the agent reasoning trace for a completed pipeline run.""" | |
| trace = await get_trace(crisis_id) | |
| if trace is None: | |
| raise HTTPException( | |
| status_code=404, | |
| detail=f"No trace found for crisis {crisis_id!r}.", | |
| ) | |
| return trace.model_dump(mode="json") | |