Service Architecture
Core Services
Agent Service
Create and manage AI agents.
Call Service
Manage voice calls and connections.
Organization Service
Multi-tenant organization management.
Batch Calls
Process multiple calls efficiently.
Scheduler
Schedule calls for later execution.
Knowledge Base
Store and retrieve agent knowledge.
Agent Service
File:Service/AgentService.py
Purpose: Create, configure, and manage AI agents.
Key Methods:
create_agent()- Create new agentget_agent()- Retrieve agentupdate_agent()- Update agent configurationdelete_agent()- Remove agentlist_agents()- List all agents
Call Service
File:Service/CallService.py
Purpose: Handle voice call lifecycle and routing.
Key Methods:
initiate_call()- Start outbound callhandle_incoming_call()- Receive incoming callprocess_call_stream()- Handle WebSocket audioend_call()- Disconnect callget_call_status()- Check call state
Organization Service
File:Service/OrganizationService.py
Purpose: Manage organizations and multi-tenancy.
Key Methods:
create_organization()- Create new orgget_organization()- Retrieve orgadd_member()- Add user to orgget_organization_agents()- List org agentsupdate_organization()- Update org settings
Batch Call Service
File:Service/BatchCallService.py
Purpose: Process multiple calls efficiently.
Features:
- CSV/JSON upload
- Phone number validation
- Parallel call execution
- Progress tracking
- Result reporting
Scheduler Service
File:scheduler/scheduler.py
Purpose: Schedule calls for future execution.
Features:
- One-time scheduled calls
- Recurring calls with cron
- Timezone support
- Automatic execution
- Retry logic
Knowledge Base Service
File:Service/KnowldegeBaseService.py
Purpose: Store and retrieve knowledge for agents.
Features:
- Document storage
- Semantic search
- Embedding support
- Version control
Phone Service
File:Service/PhoneService.py
Purpose: Manage phone numbers and routing.
Features:
- DID number management
- Phone number validation
- Call routing rules
- SMS capabilities
Authentication Service
File:utils/auth.py
Purpose: Handle API authentication and authorization.
Features:
- Supabase JWT verification
- Token validation
- User context extraction
- Role-based access
MCP Service
File:Service/McpService.py
Purpose: Handle external integrations via MCP.
Integrated Services:
- Telegram (messaging)
- Gmail (email)
- WhatsApp (messaging)
- Shopify (e-commerce)
Data Access Service
File:Service/Supabase.py
Purpose: Database access and persistence.
Features:
- Connection management
- Query execution
- Transaction support
- Authentication
Service Dependencies
Service Configuration
Each service can be configured via environment variables:Error Handling
All services implement consistent error handling:Logging
Services use structured logging:Testing Services
Performance Considerations
- Connection Pooling: Reuse database connections
- Caching: Cache agent configurations
- Async Operations: Use async/await for I/O
- Rate Limiting: Prevent abuse
- Monitoring: Track service health