Since I can’t share my codebase directly, here are a couple of public examples that might help:
-
Production-grade template: wassim249/fastapi-langgraph-agent-production-ready-template
-
Simpler example: Sajith-K-Sasi/chatbot_langgraph_fastapi – A lightweight example of using LangGraph with FastAPI to build a chatbot.
In my current setup, I use FastAPI primarily as a backend for the platform layer. Each incoming request triggers the execution of a precompiled LangGraph, which is initialized once when the FastAPI app starts. I deploy this via AWS ECS Fargate.
The architecture is split into two services:
- One handles the FastAPI HTTP layer.
- The other runs the LangGraph execution (workers).
These two services communicate using a pub/sub queue pattern with Redis (AWS ElastiCache) and Celery.
For managing memory and conversation state, I use the Postgres Checkpointer (on AWS RDS) to persist thread history and agent state.
Overall, each request simply routes input to the appropriate graph and invokes it.
Let me know if you have more specific questions about the setup.