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

At a glance

How it runs
Self-hosted serviceCLIFramework
Works with
Portable with changesOpenAI API
Cost
Free software; you pay for model usage
Setup effort
Medium · a few setup steps
You'll need
DockerPostgreSQLpgvectorOpenAI API keyShell / CLINetwork accessLocal filesystem
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

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.

  1. AI engineers who want a production-grade agent backend in hours rather than assembling all integrations from scratch
  2. Teams that need long-term semantic memory for multiple users without outsourcing to an external memory cloud
  3. Developers who require full LLM call tracing in Langfuse and metrics in Prometheus and Grafana
  4. Projects that need JWT authentication with session management and rate limiting for stateful conversations
  5. Engineers who want to experiment with different LLMs via a unified OpenAI-compatible endpoint like Atlas Cloud
  6. 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_KEY DEFAULT_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)

Local shell command execution

Can run terminal commands; pair with approval gates or container/OS sandboxing.

Local filesystem read/write

Modifies local files; work on a clean Git branch or dedicated worktree.

Outbound network access

Makes outbound requests; verify telemetry settings and model data routing on private repos.

What are this agent's strengths and limitations?

Pros
  • 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
Limitations
  • 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?

FollowAgents source review · FARS-2.1
Major gaps
48/ 100 5-point scale 2.4 / 5
Trust 12/29
Reliability 6/14
Adaptability 9/18
Convention 10/18
Effectiveness 7/13
Verifiability 4/8
Why each dimension lost points
Trust12 / 29 · 2.1/5

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.

Reliability6 / 14 · 2.1/5

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.

Adaptability9 / 18 · 2.5/5

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.

Convention10 / 18 · 2.8/5

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.

Effectiveness7 / 13 · 2.7/5

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.

Verifiability4 / 8 · 2.5/5

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.

Risks and how to mitigate them
  • 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.
Evidence confidence: Low Reviewed Nov 07, 2026 Reviewed revision fe052a7c6acf
See the full review method →
Maintain this project? Add the FARS badge to your README

The badge shows the current review score and verdict and links back to this page. It refreshes about once an hour after a re-review.

FARS

[![FARS review](https://followagents.com/badge/fastapi-langgraph-agent-production-ready-template.svg)](https://followagents.com/en/agents/fastapi-langgraph-agent-production-ready-template)
<a href="https://followagents.com/en/agents/fastapi-langgraph-agent-production-ready-template"><img src="https://followagents.com/badge/fastapi-langgraph-agent-production-ready-template.svg" alt="FARS review"></a>

FAQ

Does this template support non-OpenAI models like Anthropic or Google?
Currently only OpenAI-compatible APIs are supported (via LLMRegistry using langchain_openai.ChatOpenAI). Multi-provider support is planned in issue #51.
Does long-term memory require a separate mem0 cloud account?
No. Long-term memory is self-hosted; mem0 runs in-process and persists to your existing PostgreSQL (via pgvector). You only need a valid OPENAI_API_KEY for fact extraction and embeddings.
Can I disable Langfuse tracing?
Yes, set LANGFUSE_TRACING_ENABLED=false or omit the Langfuse keys. Structured logs still capture request/session/user context.
What if the API won't start?
Ensure PostgreSQL is running (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?
Rate limits are defined in 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.
Was this page helpful?
View on GitHub ↗ Install ↓

Compare agents like this one

The same FARS review applied across the shortlist this agent qualifies for.

Related concepts