This is the easiest way to run Langfuse with ChainAgents using Docker Compose: run Langfuse with its official Compose stack, then point ChainAgents at that Langfuse instance.
ChainAgents already supports Langfuse tracing through Langfuse's LangChain
callback handler. The local compose.yaml in this repository only starts the
optional ChainAgents Postgres service; it does not currently include a
ChainAgents app container or a Langfuse stack.
Use the official Langfuse Docker Compose deployment:
git clone https://github.com/langfuse/langfuse.git
cd langfuseBefore starting it, update the secrets marked CHANGEME in the Langfuse
Compose file or provide equivalent .env values.
Then start Langfuse:
docker compose up -dOpen Langfuse at:
http://localhost:3000
Create a project in Langfuse and copy its public and secret API keys.
Reference: https://langfuse.com/self-hosting/deployment/docker-compose
In deepagent.toml, enable the Langfuse block:
[langfuse]
enabled = trueFrom the ChainAgents repository root:
cd /Users/amin/pythonProjects/ChainAgents
export LANGFUSE_PUBLIC_KEY="pk-lf-..."
export LANGFUSE_SECRET_KEY="sk-lf-..."
export LANGFUSE_BASE_URL="http://localhost:3000"
uv run chainlit run main.py -wSend one message in Chainlit, then check the Langfuse trace table. ChainAgents passes the LangGraph thread ID as the Langfuse session ID for Chainlit, CLI, TUI, and API runs.
If you also want durable ChainAgents checkpoints and /memories/, you can run
the repository's Postgres service:
docker compose up -d postgresHowever, Langfuse's official Compose file also binds Postgres to host port
5432. If both stacks run on the same machine, change the ChainAgents
Postgres host port in compose.yaml from:
ports:
- "5432:5432"to:
ports:
- "5433:5432"Then point ChainAgents at that database:
export DATABASE_URL="postgresql://chainagents:chainagents@127.0.0.1:5433/chainagents?sslmode=disable"- For Langfuse Cloud, use
LANGFUSE_BASE_URL="https://cloud.langfuse.com". - For a fully single-command deployment, ChainAgents still needs a Docker
deployment pass: add a
Dockerfile,.dockerignore, app service, Node/npm support for the existingnpxMCP server, and Compose wiring from the app service tohttp://langfuse-web:3000.