This project provides a modular and configurable framework for creating and managing different types of conversational agents using LangGraph and FastAPI.
- Configurable Agent Creation: Easily switch between different agent implementations (e.g., stateful vs. deep agents) via a simple API call.
- Modular Architecture: A clean separation of concerns between the API layer, core business logic, and agent implementations.
- Session Management: Robust session handling for multi-turn conversations.
- Dynamic Agent Loading: New agent types can be added without modifying the core application logic.
- CLI Debugging: Test and debug agents directly from the command line.
- Comprehensive Documentation: Detailed documentation on the architecture, API, data models, and agent management.
- Python 3.13+
uvinstalled (pip install uv)- An environment variable
GOOGLE_API_KEYwith a valid Google API key.
-
Clone the repository:
git clone <repository-url> cd langgraph-agentserver
-
Create a virtual environment and install dependencies:
uv venv .venv source .venv/bin/activate uv sync
To run the application, use the manage.py script:
python manage.pyThis will start the FastAPI server on http://localhost:8000.
Once the application is running, you can create a new agent and chat with it using curl:
-
Create a stateful agent:
curl -X POST http://localhost:8000/agents -H "Content-Type: application/json" -d '{"agent_template": "stateful_agent"}'
This will return an
agent_id. -
Chat with the agent:
curl -X POST http://localhost:8000/agents/{agent_id}/chat -H "Content-Type: application/json" -d '{"message": "Hello, agent!"}'Replace
{agent_id}with the ID you received in the previous step.
For a detailed API reference, see the API Reference.
For information on how to debug the agents directly from the command line, see the CLI Debugging Guide.
For more detailed information about the project, see the documentation.
To run the test suite, use the following command:
pytest