Skip to main content

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 agent
  • get_agent() - Retrieve agent
  • update_agent() - Update agent configuration
  • delete_agent() - Remove agent
  • list_agents() - List all agents
Example:

Call Service

File: Service/CallService.py Purpose: Handle voice call lifecycle and routing. Key Methods:
  • initiate_call() - Start outbound call
  • handle_incoming_call() - Receive incoming call
  • process_call_stream() - Handle WebSocket audio
  • end_call() - Disconnect call
  • get_call_status() - Check call state
Example:

Organization Service

File: Service/OrganizationService.py Purpose: Manage organizations and multi-tenancy. Key Methods:
  • create_organization() - Create new org
  • get_organization() - Retrieve org
  • add_member() - Add user to org
  • get_organization_agents() - List org agents
  • update_organization() - Update org settings
Example:

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
Example:

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
Example:

Knowledge Base Service

File: Service/KnowldegeBaseService.py Purpose: Store and retrieve knowledge for agents. Features:
  • Document storage
  • Semantic search
  • Embedding support
  • Version control
Example:

Phone Service

File: Service/PhoneService.py Purpose: Manage phone numbers and routing. Features:
  • DID number management
  • Phone number validation
  • Call routing rules
  • SMS capabilities
Example:

Authentication Service

File: utils/auth.py Purpose: Handle API authentication and authorization. Features:
  • Supabase JWT verification
  • Token validation
  • User context extraction
  • Role-based access
Example:

MCP Service

File: Service/McpService.py Purpose: Handle external integrations via MCP. Integrated Services:
  • Telegram (messaging)
  • Gmail (email)
  • WhatsApp (messaging)
  • Shopify (e-commerce)
Example:

Data Access Service

File: Service/Supabase.py Purpose: Database access and persistence. Features:
  • Connection management
  • Query execution
  • Transaction support
  • Authentication
Example:

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

Next Steps

Batch Calls

Process multiple calls.

Scheduler

Schedule future calls.

API Reference

API documentation.