System Architecture Diagram
Core Services
1. Agent Service (Service/AgentService.py)
Responsibilities:
- Create and manage AI agents
- Configure system prompts and behavior
- Handle agent lifecycle (create, update, delete)
- Manage conversation context
- Multi-provider AI support (Gemini, OpenAI, Hume)
- Custom system prompts
- Tool/function calling
- Context management
2. Call Service (Service/CallService.py)
Responsibilities:
- Manage voice call lifecycle
- Handle call routing and connection
- Process call recordings
- Track call metadata
- Create call request
- Initialize call connection
- Stream audio to AI agent
- Process agent responses
- Return audio to caller
- Log call metadata
3. Organization Service (Service/OrganizationService.py)
Responsibilities:
- Manage multi-tenant organizations
- Handle credentials per organization
- Manage API keys and authentication
- Organization billing and usage
- Organization creation
- Member management
- API key generation
- Usage tracking
4. Scheduler Service (scheduler/scheduler.py)
Responsibilities:
- Schedule calls at specific times
- Manage recurring call patterns
- Trigger batch operations
- Handle call execution
- Uses APScheduler for scheduling
- Stores schedule in Supabase
- Supports cron expressions
5. Batch Call Service (Service/BatchCallService.py)
Responsibilities:
- Process multiple calls in bulk
- Handle CSV upload and parsing
- Manage batch execution progress
- Generate batch reports
- Upload call list (CSV/JSON)
- Validate phone numbers
- Schedule calls
- Monitor progress
- Generate results report
AI Bridges
AI bridges abstract the different AI provider APIs into a common interface.Supported Providers
Bridge Interface
Communication Layer
Telephony Providers
Twilio:- Incoming call handling via webhooks
- TwiML response generation
- Real-time media streaming
- Call recording
- Similar to Twilio
- Alternative provider for redundancy
- REST API for outbound calls
LiveKit Integration
For real-time communication:- WebRTC media streaming
- Low-latency audio processing
- Video support
- Room-based communication
MCP Integration Layer
Model Context Protocol services enable integration with external platforms:Service Architecture
Supported Integrations
Data Layer
Supabase Database Schema
Request Flow Examples
Outbound Call Flow

Incoming WebSocket Stream
Scaling Considerations
Horizontal Scaling
- Stateless API servers (multiple instances)
- Load balancer (nginx, AWS ALB)
- Shared database (Supabase)
- Message queue for async tasks (optional: Redis/RabbitMQ)
Vertical Scaling
- Increase server resources (CPU, memory)
- Database connection pooling
- Caching layer (Redis)
- CDN for media files
Security Architecture
Authentication
Data Protection
- Encryption at rest (Supabase)
- TLS/SSL for transport
- API key rotation
- Audit logging
Technology Stack
Next Steps
AI Agents
Learn how to create and configure AI agents.
Call Management
Understand call routing and handling.
Services
Explore available services.
Integrations
Integrate external platforms.