Skip to content

AI Engine Overview

The AI Engine serves as the cornerstone of AngelCX's conversational AI infrastructure. It provides a public-facing API that manages visitor sessions and handles both text and voice-based conversations.

Core Responsibilities

  • Session management for visitor conversations
  • Processing and generating AI responses using Amazon Bedrock Foundation Models and Ultravox
  • Handling both text and voice-based interactions
  • Managing bot UI configuration

Text Conversation Flow

1. Session Creation

  • Initializes a new session for each visitor
  • Stores session data in the connected database
  • No authentication required for public access

2. Response Generation

  • Processes visitor queries
  • Maintains conversation history per session
  • Integrates with Amazon Bedrock FM for AI responses
  • Returns contextual responses based on conversation history

3. Session Termination

  • Marks the session as completed
  • Triggers the Post Session API for follow-up processes:
    • Analytics processing
    • Visitor email notifications
    • Other post-conversation tasks
sequenceDiagram participant Visitor participant BotFrontend participant AIEngine participant Bedrock participant DB participant PostSession Visitor->>BotFrontend: Start conversation BotFrontend->>AIEngine: Create session AIEngine->>DB: Initialize session DB-->>AIEngine: Session created AIEngine-->>BotFrontend: Session info loop Conversation Visitor->>BotFrontend: Send message BotFrontend->>AIEngine: Generate response AIEngine->>DB: Fetch conversation history DB-->>AIEngine: History AIEngine->>Bedrock: Generate AI response Bedrock-->>AIEngine: Response AIEngine->>DB: Update conversation AIEngine-->>BotFrontend: Response BotFrontend-->>Visitor: Display response end Visitor->>BotFrontend: End conversation BotFrontend->>AIEngine: End session AIEngine->>DB: Update session end mark AIEngine->>PostSession: Process post session data

Voice Conversation Flow

1. Session Creation

  • Initiated by Bot Frontend
  • Integrates with Ultravox for call handling
  • Creates a call session in database
  • Returns a JoinURL for the call connection

2. Session Termination (Webhook)

  • Triggered by Ultravox webhook
  • Updates call transcription in database
  • Marks session as completed
  • Triggers Post Session API for follow-up processes
sequenceDiagram participant Visitor participant BotFrontend participant AIEngine participant Ultravox participant DB participant PostSession Visitor->>BotFrontend: Start voice call BotFrontend->>AIEngine: Create voice session AIEngine->>Ultravox: Create call Ultravox-->>AIEngine: Call ID AIEngine->>DB: Create call session AIEngine-->>BotFrontend: Join URL BotFrontend-->>Visitor: Connect to call Visitor->>Ultravox: Voice conversation Ultravox->>AIEngine: End call webhook AIEngine->>DB: Update transcription AIEngine->>DB: Mark session ended AIEngine->>PostSession: Process post call data PostSession-->>AIEngine: Processing complete

Security Note: A security enhancement is planned to implement secret key authentication for the Ultravox webhook endpoint to ensure only authorized calls are processed.

Bot UI Configuration

The AI Engine also serves UI configuration for the bot frontend, including:

  • Custom styling parameters
  • Visual customization options
  • Frontend behavior settings

This configuration API is intentionally housed within the AI Engine to:

  1. Maintain a single point of contact for the bot frontend
  2. Reduce the number of publicly exposed components
  3. Ensure consistency in API management

Integration Points

  • Amazon Bedrock: For AI response generation
  • Ultravox: For voice call handling
  • Post Session API: For post-conversation processing
  • Bot Frontend: Primary client for the AI engine API

Architecture Benefits

  • Simplified Frontend Integration: Single API backend for all bot-related operations
  • Scalable Session Management: Efficient handling of concurrent conversations as hosted on Lambda and call related connections offloaded to Ultravox