r/LangChain • u/Moist_Tonight_3997 • Jun 08 '26
Open-source template: FastAPI + LangGraph for AI agent workflows
https://github.com/samirpatil2000/agentic-templateBuilt a starter template that wires FastAPI and LangGraph together for serving AI agent workflows as a REST API.
Highlights:
REST endpoints to start, continue, and query workflows
Middleware stack using contextvars for automatic request tracing (X-Trace-ID, user/tenant context)
ThreadPoolExecutor for non-blocking LangGraph execution
PostgreSQL-backed state persistence and checkpointing
Structured JSON / concise logging with rotation
Docker Compose setup for Grafana + Loki + Prometheus + Promtail
LiteLLM integration with retry utilities
Most LangGraph examples are notebooks this gives you the production plumbing (persistence, observability, concurrency) so you can swap in your own agent logic and go.
Feedback welcome, especially on the FastAPI patterns.
1
2
1
u/ivanzhaowy Jun 09 '26
This is the kind of plumbing most agent demos skip.
One thing I’d make very explicit is the run contract: trace id, tenant/user context, checkpoint, retry policy, last verified state, and any side effects already emitted. That makes “continue” safer than just resuming a thread.
If you’re building agent infra like this, Monadix is looking for early agent creators to join the network: https://monadix.ai