How pavaner2007/admissioncallagent works
Purpose and Entry Points
MindBloom AI is a real-time mental-health voice companion for telephone calls. Its primary runtime is an async FastAPI service, started from app/main.py, that accepts Twilio call/media events through app/api/call_handler.py. Container deployment is defined by Dockerfile; render.yaml indicates managed-host deployment support.
Telephony and Session Boundary
Twilio is the external call-control and bidirectional media-stream provider. The call handler is the ingress boundary for incoming webhooks and WebSocket audio; Twilio-specific operations are isolated in app/services/twilio_service.py. Per-call handling must preserve conversation context, language, sentiment, and crisis state while keeping media processing asynchronous.
• app/api/call_handler.py
• app/services/twilio_service.py
• app/main.py
Audio Processing Pipeline
Caller audio arrives as Twilio μ-law/8 kHz media. Audio utilities perform the format boundary needed for speech processing, while synthesized output is converted back to telephony-compatible audio before return over the stream. FFmpeg is a material runtime dependency per the project design.
• app/utils/audio_utils.py
• app/services/twilio_service.py
• app/services/sarvam_service.py
Speech AI Stage
Sarvam AI provides multilingual speech-to-text and text-to-speech. The orchestration flow is inbound audio → transcription → response text → synthesized audio. This service is the provider boundary for API credentials, request/response formats, language selection, and speech latency.
• app/services/sarvam_service.py
• app/utils/audio_utils.py
Conversational Intelligence and Safety
The intelligence service owns Groq-backed LLM interaction and conversation behavior: empathetic responses, guided breathing, mood/sentiment handling, crisis detection, and appointment-booking intent. It consumes transcribed text plus session history and returns response text and actionable safety/integration signals rather than directly owning telephony transport.
• app/services/intelligence_service.py
• app/api/call_handler.py
Notification and External Actions
Crisis escalation and session-summary notifications cross an SMTP/email boundary via the email service. Google Forms is an external scheduling target surfaced by booking intent; the repository tree does not show a dedicated Google Forms adapter, so this likely remains URL/intent-driven logic in intelligence orchestration.
• app/services/email_service.py
• app/services/intelligence_service.py
Operational Shape and Legacy Surface
The supported application package is under app/, with Python 3.11+, FastAPI/ASGI, Docker, Twilio, Sarvam, Groq, SMTP, and optional public tunneling for local webhook development. Root-level prototype.py, rag_service.py, twilio_handler.py, and test_call.py appear to be prototype or alternate integration surfaces; avoid treating them as the primary production path without validating usage.
• pyproject.toml
• requirements.txt
• Dockerfile
Main entry points: call_handler.py Call Handler · intelligence_service.py Intelligence Service · audio_utils.py Audio Utilities · main.py FastAPI Application
Components 14
Application Runtime
- FastAPI Application
app/main.py - Call Handler · Maintains asynchronous per-call session state.
app/api/call_handler.py - Twilio Service
app/services/twilio_service.py - Email Service
app/services/email_service.py - Container Deployment
Dockerfile
Voice & Intelligence Pipeline
- Audio Utilities · Converts Twilio μ-law/8 kHz audio for speech processing and return.
app/utils/audio_utils.py - Sarvam Service · Handles multilingual transcription and synthesis.
app/services/sarvam_service.py - Intelligence Service · Produces empathetic responses and safety or booking signals.
app/services/intelligence_service.py - FFmpeg
External Providers
- Twilio · Call control and bidirectional media streams.
- Sarvam AI
- Groq
- SMTP Email
- Google Forms · Booking intent is URL or intent driven.
Connections 14
- Twilio → Call Handler: webhooks and media stream
- FastAPI Application → Call Handler: mounts routes
- Call Handler → Twilio Service: call control and stream I/O
- Call Handler → Audio Utilities: inbound and outbound audio
- Audio Utilities → Sarvam Service: speech-ready audio
- Audio Utilities → FFmpeg: format conversion
- Sarvam Service → Sarvam AI: STT and TTS requests
- Call Handler → Intelligence Service: transcript and session history
- Intelligence Service → Groq: LLM interaction
- Intelligence Service → Email Service: crisis and summary notifications
- Email Service → SMTP Email: sends email
- Intelligence Service → Google Forms: booking intent
- Twilio Service → Twilio: call and media responses
- Container Deployment → FastAPI Application: runs service