How xdefox/mts_hacaton_ai_agent works
MTS Hackathon Track 1 is an AI secretary for incoming calls. Its main workflow accepts text or audio, transcribes voice when needed, produces a classified response, optionally synthesizes speech, and records the call for review. Supporting capabilities include routing rules and scenarios, per-line service settings, call history and analytics, Telegram notifications, and readiness checks. The README describes these features; some service connections below are based on the SOURCE INDEX because their implementations were not excerpted.
Main entry points: routes_call.py Call API · main.py FastAPI startup · call_agent.py Call agent · speech_providers.py Speech provider selection
Components 29
API and startup
- FastAPI startup
backend/main.py - Call API
backend/api/routes_call.py - API schemas
backend/schemas.py
Call processing
- Call agent
backend/services/call_agent.py - Routing rules
backend/services/routing_rules.py - Scenarios
backend/services/scenarios.py - Training examples
backend/services/training_examples.py - System prompt
backend/prompts/system_ivan.py - YandexGPT
backend/services/yandex_llm.py - Local LLM
backend/services/local_llm.py
Speech services
- Speech provider selection
backend/services/speech_providers.py - Local STT
backend/services/local_stt.py - SpeechKit
backend/services/speechkit_stt.py - Local TTS
backend/services/local_tts.py - Audio storage
backend/services/tts_storage.py
History and controls
- Runtime configuration
backend/config.py - Database session
backend/database.py - Call history store
backend/models.py - History service
backend/services/call_history.py - Call analytics
backend/services/analytics.py - Line settings
backend/services/service_settings.py - Telegram notifications
backend/services/telegram_notify.py - Readiness checks
backend/services/readiness.py - Demo warmup
backend/services/warmup.py
Owner interfaces
- Telegram bot
frontend/tg_bot.py - Call dashboard
frontend/tg_dashboard.py - Web interface
frontend/app.py
Other components
- Caller
- Telegram
Connections 36
- Caller → Call API: submits call
README.md - FastAPI startup → Call API: mounts routes
backend/main.py - FastAPI startup → Database session: initializes
backend/main.py - FastAPI startup → Demo warmup: starts warmup
backend/main.py - FastAPI startup → Readiness checks: checks readiness
backend/main.py - Call API → API schemas: validates requests
backend/api/routes_call.py - Call API → Call agent: processes calls
backend/api/routes_call.py - Call agent → Routing rules: checks routing
backend/services/call_agent.py - Call agent → YandexGPT: requests response
backend/services/call_agent.py - Call agent → Local LLM: uses local model
- YandexGPT → System prompt: builds prompt
backend/services/yandex_llm.py - Local LLM → System prompt: builds prompt
backend/services/local_llm.py - System prompt → Scenarios: loads scenarios
backend/prompts/system_ivan.py - System prompt → Training examples: loads examples
backend/prompts/system_ivan.py - Call API → Speech provider selection: selects speech service
backend/api/routes_call.py - Speech provider selection → Local STT: selects local STT
backend/services/speech_providers.py - Speech provider selection → SpeechKit: selects SpeechKit
backend/services/speech_providers.py - Speech provider selection → Local TTS: selects local TTS
backend/services/speech_providers.py - Call API → Audio storage: stores generated audio
backend/api/routes_call.py - Call API → History service: reads and records calls
backend/api/routes_call.py - Call API → Call analytics: requests statistics
backend/api/routes_call.py - Call API → Line settings: manages line settings
backend/api/routes_call.py - Call API → Telegram notifications: manages notifications
backend/api/routes_call.py - Database session → Runtime configuration: loads database config
backend/database.py - Database session → Call history store: creates tables
backend/database.py - History service → Call history store: queries records
backend/services/call_history.py - Call analytics → Call history store: reads records
backend/services/analytics.py - Line settings → Runtime configuration: uses root path
backend/services/service_settings.py - Telegram notifications → Telegram: sends messages
backend/services/telegram_notify.py - Demo warmup → Local STT: warms speech model
backend/services/warmup.py - Demo warmup → Runtime configuration: uses settings
backend/services/warmup.py - Readiness checks → Database session: checks database
backend/services/readiness.py - Telegram bot → Call dashboard: renders dashboard
frontend/tg_bot.py - Web interface → Call dashboard: uses dashboard views
frontend/app.py - Web interface → Telegram notifications: uses notification service
frontend/app.py - Telegram bot → Line settings: manages preferences
frontend/tg_bot.py