An open-source AI customer support agent that automatically detects the customer's language, searches a knowledge base, and responds in the customer's native language — all through a single REST API.
Built with FastAPI and the Anthropic Claude API. Designed to be dropped into any existing support stack.
Customer message (any language)
↓
Language detection — identifies the language automatically
↓
Query translation — translates to English for KB search
↓
Knowledge base search — semantic search finds relevant articles
↓
Claude agent — generates a response using KB context
↓
Reply in customer's language
Conversation history is maintained per session so the agent understands follow-up questions.
- Auto language detection — English, German, French (more trivially addable)
- Semantic knowledge base search using Voyage AI embeddings
- Multi-turn conversation memory (in-memory or Redis)
- Analytics endpoint — language distribution, top KB articles, gaps report
- Fully configurable via environment variables
- Docker ready
git clone https://github.com/yourusername/multilingual-support-agent.git
cd multilingual-support-agent
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
# Add your ANTHROPIC_API_KEY and VOYAGE_API_KEY to .envuvicorn app.main:app --reloadAPI docs available at http://localhost:8000/docs
curl -X POST http://localhost:8000/api/v1/chat \
-H "Content-Type: application/json" \
-d '{
"message": "Wie kann ich mein Passwort zurücksetzen?",
"session_id": "user-123"
}'{
"response": "Um Ihr Passwort zurückzusetzen, gehen Sie zur Anmeldeseite...",
"detected_language": { "code": "de", "name": "German", "confidence": 0.998 },
"knowledge_base_hits": [
{ "question": "How do I reset my password?", "score": 0.91 }
]
}Replace app/data/knowledge_base.json with your own FAQ data:
[
{
"id": "kb_001",
"category": "Returns",
"question": "What is your return policy?",
"answer": "We accept returns within 30 days of purchase.",
"keywords": ["return", "refund", "policy", "30 days"]
}
]Then call POST /api/v1/kb/reload — no restart needed.
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/v1/chat |
Send a customer message |
| GET | /api/v1/analytics |
Usage report — languages, KB hits, gaps |
| GET | /api/v1/sessions |
List active sessions |
| DELETE | /api/v1/sessions/{id} |
Clear a session |
| POST | /api/v1/kb/reload |
Reload knowledge base from disk |
| GET | /api/v1/languages |
List supported languages |
All settings via .env:
| Variable | Default | Description |
|---|---|---|
ANTHROPIC_API_KEY |
— | Required |
VOYAGE_API_KEY |
— | Required — get free key at voyageai.com |
SUPPORTED_LANGUAGES |
["en","de","fr"] |
Languages to handle |
SESSION_BACKEND |
memory |
memory or redis |
KB_TOP_K |
3 |
KB articles retrieved per query |
MAX_HISTORY_TURNS |
10 |
Conversation turns kept in context |
docker-compose up --buildpytest tests/ -vNo API keys needed — all tests use mocks.
- FastAPI — REST API framework
- Anthropic Claude — response generation and translation
- Voyage AI — semantic embeddings for KB search
- langdetect — offline language detection
- Redis (optional) — persistent session storage