Stable
FastAPI Integration
Use decorators inside FastAPI services to capture runtime traces from API-triggered agent workflows and push sessions to Neurovn.
Install & Run
Install
Setuppip install fastapi uvicornpip install neurovnRun
ExecuteNEUROVN_API_URL=https://agentic-flow.onrender.com uvicorn app:app --reloadArchitecture Flow
Ingress
Request enters FastAPI route and starts workflow execution.
Trace
Decorated functions capture agent/tool steps and runtime metrics.
Persist
Completed session is published for canvas replay and estimate validation.
Implementation Snippets
Pattern
pythonfrom fastapi import FastAPIfrom neurovn import traceapp = FastAPI()@trace.agent(name="API Agent", model="GPT-4.1", provider="OpenAI")def run_job(payload: dict) -> dict: return {"ok": True}@app.post("/run")def run(payload: dict): return run_job(payload)Troubleshooting
Avoid blocking network calls in synchronous routes for predictable latency traces.
Mask sensitive request payload fields before custom logging.
Use one trace session per API request for deterministic auditability.
If you want a single canvas for each request lifecycle, open `trace.session(...)` at the route or service entrypoint instead of relying only on nested decorators.
Related Integrations
Backend contracts: `/api/estimate`, `/api/traces/sessions`, `/api/canvases`