FastAPI LangGraph Agent Production-Ready Template
A production-ready backend template for AI agent services, bundling LangGraph, long-term memory, observability, and auth.
- Stars
- ★ 2.8k
- Last updated
- 1mo ago
- FARS reviewed
- Nov 07, 2026
- License
- MIT
- Primary language
- Python
- FA score
- 48/100 · Major gaps
At a glance
- How it runs
- Works with
- Portable with changesOpenAI API
- Cost
- Free software; you pay for model usage
- Setup effort
- Medium · a few setup steps
- You'll need
- Typical use
- AI engineers who want a production-grade agent backend in hours rather than assembling all integrations from scratch
- Not a fit if
- Users who want Anthropic or Google providers today
- Simple projects that don't need a database or monitoring
- Maintenance
- Commits in the last 6 monthslast commit 2026-10-17+0.7 ★/day over 7 days
- Source review
- 48/100 · Major gaps
What does this agent do, and when should you use it?
FastAPI LangGraph Agent Template is a production-grade starting point for building AI agent backends. It handles stateful conversations, long-term memory (via mem0 and pgvector), tool calling, observability (Langfuse, Prometheus, Grafana), rate limiting, and JWT authentication, so developers can focus on agent logic. The template includes an LLMRegistry service with circular fallback and exponential backoff retries, working with OpenAI-compatible endpoints like Atlas Cloud. The project provides Alembic migrations, an optional Valkey/Redis cache layer, structured logging, and extensive documentation covering architecture, configuration, and evaluation. It is deployable via Docker Compose or locally with Makefile commands.
On startup, it boots a FastAPI application exposing API routes under /docs, and connects to PostgreSQL (SQLModel ORM with Alembic migrations). The agent graph lives in app/core/langgraph/ and supports stateful conversations with checkpointing and tool calling; tools can be added in app/core/langgraph/tools/. LLM calls go through the LLMRegistry, which uses langchain_openai.ChatOpenAI and is configured with DEFAULT_LLM_MODEL, OPENAI_BASE_URL, and OPENAI_API_KEY environment variables; the service rotates across models on failure with a total timeout budget. Long-term memory is provided by in-process mem0 persisted to PostgreSQL with pgvector for semantic search. All LLM calls are traced with Langfuse, and Prometheus exposes metrics. JWT authentication handles sessions, and slowapi enforces rate limits. An evaluation framework (evals/) is also included.
- AI engineers who want a production-grade agent backend in hours rather than assembling all integrations from scratch
- Teams that need long-term semantic memory for multiple users without outsourcing to an external memory cloud
- Developers who require full LLM call tracing in Langfuse and metrics in Prometheus and Grafana
- Projects that need JWT authentication with session management and rate limiting for stateful conversations
- Engineers who want to experiment with different LLMs via a unified OpenAI-compatible endpoint like Atlas Cloud
- Teams that need a complete template with Docker, database migrations, and monitoring stack for quick project bootstrapping
Key setup facts
Pulled from the install and usage notes below. The project README has the current values.
- Environment variables
OPENAI_API_KEYDEFAULT_LLM_MODEL- Config files
.env.example.env.development- Install notes cover
- Docker
How do you install or deploy this agent?
Clone the repository and enter the directory, then copy .env.example to .env.development and fill in keys (OPENAI_API_KEY or Atlas Cloud credentials, plus database config). Ensure Docker is installed, then run make install and make docker-up to start the API and PostgreSQL. For local development, refer to docs/getting-started.md.
How do you use this agent?
After starting Docker, visit [http://localhost:8000/docs](http://localhost:8000/docs) for the interactive API. Apply migrations with make migrate. Set DEFAULT_LLM_MODEL in .env.development to select a model. Add custom tools by placing a LangChain @tool-decorated function in app/core/langgraph/tools/ and registering it in the tools list exported from that package. Use Langfuse tracing, or disable it with LANGFUSE_TRACING_ENABLED=false. For full configuration, see docs/configuration.md.
Safety boundaries, hardening & integrations
Operational blast radius, source-verified safety controls, and first-run hardening steps before connecting this agent to real workspaces.
Declared capability surface (blast radius)
Can run terminal commands; pair with approval gates or container/OS sandboxing.
Modifies local files; work on a clean Git branch or dedicated worktree.
Makes outbound requests; verify telemetry settings and model data routing on private repos.
What are this agent's strengths and limitations?
- Includes a full set of production components out of the box: Alembic migrations, mem0+pgvector long-term memory, Langfuse tracing, Prometheus/Grafana metrics, JWT sessions, and slowapi rate limiting
- LLM service features exponential backoff retries and circular fallback, ensuring high availability
- Supports 59+ OpenAI-compatible models via Atlas Cloud, enabling quick model switching
- Comprehensive documentation from architecture to configuration and evaluation lowers onboarding effort
- Currently only natively supports OpenAI-compatible APIs; multi-provider support (Anthropic, Google) is still planned (issue #51) and requires extra adaptation
- Long-term memory depends on PostgreSQL + pgvector, adding database management overhead
- The full production feature set (JWT, caching, monitoring) may be overkill for simple projects
- Limited to OpenAI provider for now; using other providers may require waiting for updates or manual code changes
How does this agent compare with similar options?
Key facts side by side with the most closely related agents.
| Agent | Source review | Form / cost | Stars | Updated | Language | Full support on |
|---|---|---|---|---|---|---|
| FastAPI LangGraph Agent Production-Ready Template This agent | 48 · Major gaps | Self-hosted serviceFree + model costs | ★ 2.8k | 1mo ago | Python | OpenAI API |
| Enterprise AI Agent Platform | 57 · Major gaps | Self-hosted service | ★ 170 | 1d ago | Python | — |
| Agents Towards Production | 44 · Major gaps | Library / SDKFree + model costs | ★ 22k | 17d ago | Jupyter Notebook | — |
| Idun Agent Platform | 51 · Major gaps | Self-hosted serviceFree + model costs | ★ 209 | 8d ago | Python | — |
How does FollowAgents rate this agent?
Why each dimension lost points
The template provides baseline protections through JWT, bcrypt, rate limits, environment-based configuration, and private vulnerability reporting; its security notes also advise restricting CORS and allow disabling Langfuse. However, CORS defaults to all origins, Langfuse is enabled by default and handles conversation traces, and LLM and memory features transmit data to external services. User confirmation and fine-grained permission guidance are limited, so least privilege, confirmation, and external-effects scores remain partial. Dependencies have lower bounds or occasional pins, but no dependency audit or mitigation evidence is shown; rollback is not documented. The MIT attribution is visible, while publisher identity and provenance remain unverified.
The documentation describes retries, circular model fallback, a timeout budget, health checks, and structured error responses, supporting ordinary failure handling. README paths and component descriptions do not fully align with the supplied AGENTS.md and setup guidance; for example, service paths differ between the structure overview and customization instructions, reducing self-consistency. Dependency declarations and CI checks are visible, but this static review does not score runtime or reproducibility results, and the materials do not independently show that these mechanisms succeed in practice.
The README identifies AI engineers as its audience and describes chat, memory, tools, and monitoring scenarios. The docs provide Docker and local setup, optional Langfuse and cache configuration, and model-provider options. Capability boundaries, behavior under unexpected input or external-service failure, and suitability limits are lightly documented. Triggers are mainly ordinary API requests and environment settings, with little detail on permission or confirmation policies.
The README, topic-based guides, project outline, FAQ, configuration tables, and setup steps provide a usable information structure; install and deployment paths include concrete commands. Conflicting path descriptions limit confidence in naming stability, known limitations are only partly covered, and no changelog is shown. The LICENSE clearly grants MIT rights and states the terms, earning full marks. SECURITY.md identifies the master branch, private reporting channels, response targets, and fork-maintainer responsibility, though maintenance and update commitments do not cover every use case.
The template combines authentication, sessions, LangGraph, persistent memory, observability, and deployment guidance into a foundation engineering teams can use to get started. Examples and API calls support practical use. The incremental value over a basic LangGraph setup is supported by the feature list and guides, but there is no independent usage or performance evidence; multiple external services, database setup, secrets, and operational components also add ongoing cost, with little cost-benefit discussion.
Several feature claims have supporting references in the configuration guide, security policy, README, and supplied application entry point; dependencies, CI workflows, and the MIT license are also directly documented. Conflicting descriptions across files limit corroboration. Documentation generally separates configuration facts from security advice, but broad claims such as production readiness lack validation evidence. This assessment uses only static materials and makes no claim of execution or independent verification.
- Before deployment, review CORS origins, Langfuse conversation tracing, data sent to LLM and memory services, and production secrets; the security notes also recommend these checks.
- Some file paths differ across the README and supporting guides; confirm configuration and customization locations against the repository before relying on them.
FAQ
Does this template support non-OpenAI models like Anthropic or Google?
LLMRegistry using langchain_openai.ChatOpenAI). Multi-provider support is planned in issue #51.Does long-term memory require a separate mem0 cloud account?
OPENAI_API_KEY for fact extraction and embeddings.Can I disable Langfuse tracing?
LANGFUSE_TRACING_ENABLED=false or omit the Langfuse keys. Structured logs still capture request/session/user context.What if the API won't start?
make docker-up brings it up), .env.development exists with required keys, and run make migrate to apply migrations.How do I adjust the rate limiting policy?
app/core/limiter.py (slowapi). You can change per-route decorators or the default rate, and related environment variables are documented in docs/configuration.md.Thanks — we use this to improve the page.
Subscribe to the FollowAgents RSS feed, or save this agent to your browser shortlist to compare on your next visit.