Agentic Chatbot Webapp with Google ADK + LiteLLM
botai/
βββ frontend/ # React + Vite + TailwindCSS
β βββ Chat interface with streaming support
βββ backend/ # Python + FastAPI + Google ADK
β βββ gRPC service (port 50051)
β βββ HTTP streaming (port 8000)
βββ README.md
Frontend:
- React 18 + TypeScript
- Vite 6
- TailwindCSS 3
- Dark mode UI
Backend:
- FastAPI
- Google ADK (Agent Development Kit)
- LiteLLM (multi-provider LLM gateway)
- gRPC + HTTP streaming
cd backend
# Create virtual environment
python -m venv venv
source venv/bin/activate # Linux/Mac
# or: venv\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
# Configure environment
cp .env.example .env
# Edit .env and add your LITELLM_API_KEY
# Generate gRPC files (optional, for gRPC mode)
chmod +x generate_grpc.sh
./generate_grpc.sh
# Start server
python main.pyBackend runs on:
- HTTP: http://localhost:8000
- gRPC: localhost:50051
cd frontend
# Install dependencies
npm install
# Start dev server
npm run devFrontend runs on: http://localhost:3000
Use the service manager script to start/stop/restart all services:
# Make executable (first time only)
chmod +x services.sh
# Start all services
./services.sh start
# Stop all services
./services.sh stop
# Restart all services
./services.sh restart
# Check status
./services.sh status
# View logs
./services.sh logs frontend
./services.sh logs backend
./services.sh logs allServices:
| Service | Port | URL |
|---|---|---|
| Frontend | 3001 | http://localhost:3001 |
| Backend | 8000 | http://localhost:8000 |
Logs location: /tmp/botai-logs/
# LiteLLM Configuration
LITELLM_API_KEY=your_key_here # Required
LITELLM_MODEL=gpt-4o-mini # Model to use
LITELLM_BASE_URL=https://api.openai.com/v1 # Optional
# Server Configuration
GRPC_PORT=50051
HTTP_PORT=8000You can use any model supported by LiteLLM:
- OpenAI:
gpt-4o,gpt-4o-mini,gpt-4-turbo - Anthropic:
claude-3-opus-20240229,claude-3-sonnet-20240229 - Google:
gemini-pro,gemini-1.5-pro - Open source:
meta-llama/llama-3-70b,mistral/mistral-large
Full list: https://docs.litellm.ai/docs/providers
- Open http://localhost:3000 in your browser
- Type a message and press Enter or click Send
- Watch the AI response stream in real-time
- Continue the conversation with context
POST /chat
{
"message": "Hello!",
"session_id": "optional-session-id"
}Returns: Streaming response (text/plain)
GET /health
{
"healthy": true,
"version": "1.0.0"
}ChatService.StreamChat
- Bidirectional streaming
- Proto:
backend/proto/chatbot.proto
The backend is ready for Google ADK integration. Add your agents in backend/grpc/chat_service.py:
from google.adk import Agent
agent = Agent(
name="assistant",
instructions="You are a helpful assistant",
# Add tools, memory, RAG, etc.
)from google.adk.memory import VectorMemory
memory = VectorMemory(
collection="chat_history",
embedder="text-embedding-3-small"
)For production deployment:
- Environment variables: Use proper secrets management
- CORS: Configure allowed origins in
main.py - Session storage: Replace in-memory dict with Redis
- gRPC: Use Envoy proxy for gRPC-Web in frontend
- Monitoring: Add logging, metrics, tracing
MIT