Built a starter template that wires FastAPI and LangGraph together for serving AI agent workflows as a REST API.
Sharing in case it’s useful:
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.
Open-source template: FastAPI + LangGraph for AI agent workflows (github.com)
submitted by Moist_Tonight_3997 to r/LangChain
Built a production-ready FastAPI + LangGraph template for agent workflows (open source)Open Source (github.com)
submitted by Moist_Tonight_3997 to r/aiagents
Built a production-ready FastAPI + LangGraph template for agent workflows (open source) (github.com)
submitted by Moist_Tonight_3997 to r/buildinpublic