Skip to main content

Documentation 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.

ChatAgents is configured entirely via environment variables. In local development these are loaded from a .env file by python-dotenv; in Docker they are passed directly into each service container by docker-compose.yml. There are no hard-coded secrets in the codebase — every sensitive value lives in your .env file, making it safe to share code without exposing credentials.

Creating Your .env File

Start by copying the provided sample file:
cp .env.sample .env
Then open .env and replace the placeholder values with your real API keys.

Variable Reference

ANTHROPIC_API_KEY
string
required
Claude API key for Anthropic models. All Claude Haiku, Sonnet, and Opus model calls are authenticated with this key.Format: sk-ant-api-...
Obtain: console.anthropic.com
TAVILY_API_KEY
string
required
Tavily search API key, used by the TavilySearch, TavilyExtract, and TavilyCrawl tools inside the agent graph.Format: tvly-...
Obtain: tavily.com
OPENAI_API_KEY
string
OpenAI API key. Required only when selecting an OpenAI model (GPT-5, GPT-5-mini, etc.) from the Streamlit sidebar.Format: sk-proj-...
Obtain: platform.openai.com
GROQ_API_KEY
string
Groq API key. Reserved for future Groq model support — not yet exposed in the UI but accepted by the backend.Format: gsk_your-key-here
Obtain: console.groq.com
PORT
number
default:"8080"
The port on which the FastAPI backend listens inside the container (or on the host in local development). Matches the internal container port defined in docker-compose.yml.
BACKEND_PORT
number
default:"8080"
Docker only. The host port mapped to the backend container’s 8080 port. Change this if port 8080 is already in use on your machine.
# docker-compose.yml resolves this as:
ports:
  - "${BACKEND_PORT:-8080}:8080"
FRONTEND_PORT
number
default:"8501"
Docker only. The host port mapped to the Streamlit frontend container. The default matches Streamlit’s own default port.
# docker-compose.yml resolves this as:
ports:
  - "${FRONTEND_PORT:-8501}:8501"
BACKEND_URL
string
default:"http://localhost:8080"
The URL the Streamlit frontend uses to reach the FastAPI backend. In Docker Compose this is automatically set to http://backend:8080 (using the service name) so the frontend container can resolve it via the internal Docker network.
  • Local dev: http://localhost:8080
  • Docker Compose: http://backend:8080 (set automatically in docker-compose.yml)

Local Development

For local development, your .env file should look like the sample below. Uncomment the variables you need:
# ==================== API Keys ====================
# Anthropic Claude API Key
ANTHROPIC_API_KEY=sk-ant-api-...

# Tavily API Key (for web search)
TAVILY_API_KEY=tvly-...

# OpenAI API Key (optional, only needed for OpenAI models)
OPENAI_API_KEY=sk-proj-...

# Groq API Key (optional, reserved for future use)
GROQ_API_KEY=gsk_your-key-here

# ==================== Service Port Configuration ====================
# Docker host-mapped ports (optional, defaults shown)
# BACKEND_PORT=8080
# FRONTEND_PORT=8501

# ==================== Frontend ↔ Backend Connection ====================
# Docker Compose sets BACKEND_URL=http://backend:8080 automatically.
# For local development (non-Docker), uncomment the line below:
# BACKEND_URL=http://localhost:8080

Docker Environment

When running via Docker Compose, the .env file is read by the Compose engine and injected into each service. The backend container receives all four API keys plus the PORT variable; the frontend container receives only BACKEND_URL so it knows where to send requests.
services:
  backend:
    ports:
      - "${BACKEND_PORT:-8080}:8080"
    environment:
      - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
      - TAVILY_API_KEY=${TAVILY_API_KEY}
      - OPENAI_API_KEY=${OPENAI_API_KEY}
      - GROQ_API_KEY=${GROQ_API_KEY}
      - PORT=8080

  frontend:
    ports:
      - "${FRONTEND_PORT:-8501}:8501"
    environment:
      - BACKEND_URL=http://backend:8080
The frontend never handles API keys itself — they are passed at request time as HTTP headers (see below).

Passing Keys at Runtime

The Streamlit sidebar lets users supply their own API keys. When a key is entered in the sidebar, the frontend forwards it as an HTTP request header to the backend /stream_agent endpoint instead of relying on the server-side environment variable. This allows multiple users to share a single deployment while each using their own credentials.
HeaderOverridesProvider
X-Claude-KeyANTHROPIC_API_KEYAnthropic Claude
X-Tavily-KeyTAVILY_API_KEYTavily Search
X-OpenAI-KeyOPENAI_API_KEYOpenAI
X-Groq-KeyGROQ_API_KEYGroq
The backend reads these headers first and falls back to the environment variable if no header is present:
tavily_api_key = request.headers.get("X-Tavily-Key") or os.getenv("TAVILY_API_KEY")
claude_api_key = request.headers.get("X-Claude-Key") or os.getenv("ANTHROPIC_API_KEY")
openai_api_key = request.headers.get("X-OpenAI-Key") or os.getenv("OPENAI_API_KEY")
groq_api_key   = request.headers.get("X-Groq-Key")   or os.getenv("GROQ_API_KEY")
Never commit your .env file to version control. It contains live API keys. The repository ships with .gitignore entries that exclude .env by default — do not remove them.
In a production deployment behind Nginx, keep BACKEND_URL=http://backend:8080 in the frontend service environment. Using localhost inside a container refers to the container itself, not the backend service — the Docker service name backend is the correct hostname to use.

Build docs developers (and LLMs) love