ChatAgents ships with a singleDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/EllisYuan/ChatAgents/llms.txt
Use this file to discover all available pages before exploring further.
Dockerfile and a docker-compose.yml that spin up two containers from the same image — one running the FastAPI backend (python app.py) and one running the Streamlit frontend (streamlit run streamlit_app.py). Both containers share a bridge network so the frontend can reach the backend by its service name (http://backend:8080) without any manual IP configuration.
Prerequisites
- Docker — Engine 20.10 or later recommended.
- Docker Compose — V2 (
docker compose) or the classic V1 plugin (docker-compose). Both work with the provideddocker-compose.yml.
Local Docker Deployment
Configure environment variables
Copy the sample file and fill in your API keys before building — the Compose file reads from Open
.env at startup:.env and set at minimum your ANTHROPIC_API_KEY and TAVILY_API_KEY:Build and start the containers
Run both services in detached mode with a fresh build:Docker will build the image once and launch two named containers:
chatbot-backend and chatbot-frontend. The frontend depends_on the backend passing its health check before it starts, so startup order is guaranteed.Verify both containers are running
Up (and healthy for the backend once the health check passes):Open the application
Navigate to http://localhost:8501 in your browser. The chat interface will be live and connected to the backend automatically.
docker-compose.yml Reference
Here is the full Compose configuration shipped with the project:Port Configuration
Both host-side ports are configurable via environment variables in your.env file. The container-internal ports (8080 for the backend, 8501 for the frontend) are fixed.
| Variable | Default | Description |
|---|---|---|
BACKEND_PORT | 8080 | Host port mapped to the FastAPI backend container |
FRONTEND_PORT | 8501 | Host port mapped to the Streamlit frontend container |
.env:
docker-compose up -d. The ${VARIABLE:-default} syntax in the Compose file ensures the defaults apply even when the variables are absent.
Health Checks
The backend service has a built-in Docker health check configured indocker-compose.yml:
GET /health every 30 seconds. The endpoint returns {"message": "后端 API 正在运行", "status": "healthy"} when the FastAPI app and LangGraph agent are fully initialised. The frontend container will not start until this check passes (condition: service_healthy), preventing connection errors on boot.
To tail recent backend logs and check for errors:
Data Persistence
Both containers mount the local./data directory into /app/data inside the container:
data/sessions/. Because the volume is bind-mounted from the host, session data survives container restarts and image rebuilds — you will not lose conversation history when you run docker-compose up -d --build again.
Environment Variables in Docker
All API keys and configuration values flow from your host.env file into the containers through the environment: block in docker-compose.yml:
| Variable | Injected into | Notes |
|---|---|---|
ANTHROPIC_API_KEY | backend | Required for Claude models |
TAVILY_API_KEY | backend | Required for all web tools |
OPENAI_API_KEY | backend | Optional — for OpenAI models |
GROQ_API_KEY | backend | Optional — for Groq models |
PORT | backend | Hard-coded to 8080 inside the container |
BACKEND_URL | frontend | Set to http://backend:8080 — uses Docker’s internal DNS |
Production Deployment with Nginx
Basic steps:-
Start the containers as described above:
-
Install and configure Nginx on the host, proxying
your-domain.com→localhost:8501(frontend) andapi.your-domain.com→localhost:8080(backend). See guides/nginx-setup for a complete Nginx configuration with SSL. -
Verify the backend health endpoint is reachable through your domain:
A successful response looks like:
Useful Docker Commands
Check container status
Check container status
View logs
View logs
Stop and remove containers
Stop and remove containers
Rebuild after code changes
Rebuild after code changes
Open a shell inside a container
Open a shell inside a container