By the end of this guide you will have both the FastAPI backend and the Streamlit frontend running on your machine, your API keys wired in, and a live conversation with an AI agent that can search the web, extract page content, and crawl sites in real time — all in under five minutes.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.
Prefer a one-command start? Docker Compose brings up both services with a single
docker-compose up -d --build. See the Docker Deployment page for details.Setup
Create and activate a virtual environment
Isolating dependencies in a virtual environment avoids conflicts with other Python projects on your machine.Your shell prompt will gain a
- macOS / Linux
- Windows
(venv) prefix once the environment is active.Install dependencies
Install all required Python packages from the pinned requirements file:This installs Streamlit, FastAPI, LangGraph, Tavily client libraries, Anthropic SDK, and all transitive dependencies.
Configure environment variables
Copy the provided sample file and fill in your API keys:Open
.env in your editor. The file looks like this:| Variable | Description | Required |
|---|---|---|
ANTHROPIC_API_KEY | Your Claude API key (sk-ant-api-…) | ✅ Yes |
TAVILY_API_KEY | Your Tavily search key (tvly-…) | ✅ Yes |
OPENAI_API_KEY | OpenAI key for GPT models | ❌ Optional |
GROQ_API_KEY | Groq key for Groq-hosted models | ❌ Optional |
PORT | Port the FastAPI backend listens on | Defaults to 8080 |
BACKEND_PORT | Host port Docker maps to the backend | Defaults to 8080 |
FRONTEND_PORT | Host port Docker maps to the frontend | Defaults to 8501 |
BACKEND_URL | URL the frontend uses to reach the backend | Defaults to http://localhost:8080 |
Start the backend
In your first terminal, launch the FastAPI server:The server starts on port
8080 by default (controlled by the PORT environment variable). You should see log output confirming the Web Agent has initialised:Start the frontend
Open a second terminal (keep the first one running the backend), activate the virtual environment again, then launch Streamlit:Streamlit starts on port
8501. Your default browser should open automatically, or you will see:Open the app in your browser
Navigate to the following URLs to confirm everything is running:
| Service | URL |
|---|---|
| Chat interface (Streamlit) | http://localhost:8501 |
| Backend API root (FastAPI) | http://localhost:8080 |
| Interactive API docs (Swagger UI) | http://localhost:8080/docs |
Using the Chat Interface
Once the app is open in your browser, here is how to get your first response:1. Enter your API keys in the sidebar
If you pre-configured.env, your keys are already loaded and the sidebar will show the backend as Running. If not, paste your Claude and Tavily API keys directly into the sidebar input fields — they are sent as request headers and are never stored server-side.
2. Select an agent mode
Use the mode selector in the sidebar to choose between:- ⚡ Fast Mode —
basicsearch depth, 3 results, crawl limit 5 pages. Best for quick factual lookups. - 🧠 Deep Thinking Mode —
advancedsearch depth, 5 results, crawl limit 15 pages, image support. Best for in-depth research.
3. Choose a language model
Pick a Claude model from the dropdown:| Model | Characteristics |
|---|---|
| Haiku | Fastest, most economical |
| Sonnet | Balanced performance — recommended |
| Opus | Highest capability, highest cost |
4. Start chatting
Type your question in the input box and press Enter. The agent will:- Decide which tools (if any) it needs —
TavilySearch,TavilyExtract, orTavilyCrawl. - Display each tool call inline as it happens, showing the tool name, inputs, and a summary of outputs with source links.
- Stream the final answer token-by-token directly into the chat window.