This repo is a production-ready template for building and deploying AI agents on your own infrastructure using Google ADK, LiteLLM, and Postgres.
Key Features:
- 🐳 Self-Hosted Ready: Docker & Compose setup included. No GCP lock-in.
- 🧩 Extensible: Structured for adding Tools and Sub-Agents easily.
- 💾 Persistent: Postgres-backed sessions out of the box.
- 🚀 Modern Stack: Python 3.11,
uv,fastapi,asyncpg.
- Python 3.11+
uv- A Postgres connection string (Neon works great)
- An OpenRouter API key
Create .env:
OPENROUTER_API_KEY: your OpenRouter keyDATABASE_URL: a Postgres URL (can be the standardpostgresql://...form)
Notes:
- We normalize Postgres URLs for SQLAlchemy+asyncpg automatically (e.g.
sslmode=requirebecomesssl=require).
uv syncuv run python -m serverThen open http://127.0.0.1:8000.
For production or clean local environments, use Docker.
- Add an Agent: Create a new folder in
agents/with anagent.pydefiningroot_agent. - Tools: Add functions to
agents/<your_agent>/tools/ - Main Logic: Edit
agents/<your_agent>/agent.py
ADK’s CLI defaults to local SQLite session storage unless you pass
--session_service_uri. This repo provides a custom server.py so:
- you don’t have to remember a long CLI command
- sessions always go to Postgres (once
DATABASE_URLis set) - multiple agents in
agents/are served automatically.
See:
docs/development.md