Skip to main content

How Hanc.AI Works

This page explains the technical architecture of the Hanc.AI platform — how different components work together to create intelligent voice conversations.

System Architecture Overview

┌─────────────────────────────────────────────────────────────────────────────┐
│ HANC.AI PLATFORM │
└─────────────────────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────┐
│ YOUR CUSTOMERS │
│ │
│ 📞 Phone Call 🌐 Website │
└──────────┬─────────────┬────────────┘
│ │
┌────────────────┘ └────────────────┐
│ │
▼ ▼
┌─────────────────────────┐ ┌─────────────────────────┐
│ PHONE PROVIDER │ │ WEBSITE WIDGET │
│ (Twilio) │ │ (LiveKit WebRTC) │
│ │ │ │
│ • Receives calls │ │ • Browser-based calls │
│ • Routes to agent │ │ • Click-to-call button │
│ • Handles telephony │ │ • No app required │
└───────────┬─────────────┘ └───────────┬─────────────┘
│ │
└──────────────────┬───────────────────────────┘


┌─────────────────────────────────────────────────────────────────────────────┐
│ VOICE SERVICE LAYER │
│ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Speech │ │ AI │ │ Text to │ │ Audio │ │
│ │ to Text │───▶│ Engine │───▶│ Speech │───▶│ Stream │ │
│ │ (STT) │ │ (LLM) │ │ (TTS) │ │ │ │
│ └─────────────┘ └──────┬──────┘ └─────────────┘ └─────────────┘ │
│ │ │
└────────────────────────────┼────────────────────────────────────────────────┘


┌─────────────────────────────────────────────────────────────────────────────┐
│ HANC.AI BACKEND │
│ │
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
│ │ Agent Config │ │ Knowledge Base │ │ Call Logs │ │
│ │ • Prompt │ │ • Documents │ │ • History │ │
│ │ • Settings │ │ • RAG Search │ │ • Transcripts │ │
│ │ • Tools │ │ • Embeddings │ │ • Analytics │ │
│ └─────────────────┘ └─────────────────┘ └─────────────────┘ │
│ │
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
│ │ User Accounts │ │ Integrations │ │ Billing │ │
│ │ • Auth │ │ • Twilio │ │ • Plans │ │
│ │ • Workspaces │ │ • Calendars │ │ • Usage │ │
│ │ • Teams │ │ • Webhooks │ │ • Payments │ │
│ └─────────────────┘ └─────────────────┘ └─────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘


┌─────────────────────────────────────────────────────────────────────────────┐
│ YOUR DASHBOARD │
│ │
│ 🎛️ Configure agents 📊 View analytics 📞 Manage numbers │
│ 📚 Upload knowledge 👥 Manage team 💳 Handle billing │
│ │
└─────────────────────────────────────────────────────────────────────────────┘

Call Flow: Step by Step

Scenario: Customer Calls Your Business

Let's trace what happens when a customer calls your Twilio number connected to a Hanc.AI agent:

TIME        EVENT                              SYSTEM
─────────────────────────────────────────────────────────────────────
0:00 Customer dials +43 1 234 5678 Phone network

0:02 Call reaches Twilio Twilio
Twilio routes to Hanc.AI

0:03 Agent activated Hanc.AI Voice Service
Audio stream established

0:04 Agent speaks first message: TTS Engine
"Hello! Thank you for calling
ABC Dental. How can I help?"

0:06 Customer: "I'd like to book STT Engine
an appointment for next week"

0:07 Text sent to AI Engine LLM (e.g., GPT-4)
AI searches Knowledge Base RAG System

0:08 AI generates response: LLM
"I'd be happy to help with that.
What day works best for you?"

0:09 Response converted to speech TTS Engine
Audio sent to customer

0:10 Customer: "How about Tuesday STT Engine
at 3pm?"

0:11 AI checks availability Calendar Integration
(if calendar connected)

0:12 AI: "Tuesday at 3pm is available. LLM + TTS
May I have your name please?"

... conversation continues ...

2:45 Call ends
Transcript saved Hanc.AI Backend
Analytics updated

Component Deep Dive

1. Speech-to-Text (STT)

Converts the customer's voice into text that the AI can process.

┌─────────────────────────────────────────────────────────────────┐
│ SPEECH-TO-TEXT PIPELINE │
└─────────────────────────────────────────────────────────────────┘

Audio Stream ───▶ Noise Reduction ───▶ Voice Detection ───▶ Transcription


"I need to
book an
appointment"

Key features:

  • Real-time processing (< 500ms latency)
  • Multi-language support
  • Accent adaptation
  • Background noise handling

2. AI Engine (LLM)

The "brain" that understands context and generates responses.

┌─────────────────────────────────────────────────────────────────┐
│ AI ENGINE PROCESS │
└─────────────────────────────────────────────────────────────────┘

Input: "What are your prices for teeth cleaning?"


┌─────────────────────────────────────────────────────────────────┐
│ CONTEXT ASSEMBLY │
│ │
│ System Prompt (how to behave) │
│ + Conversation History (what was said before) │
│ + Knowledge Base Results (relevant business info) │
│ + Current User Message │
│ │
└──────────────────────────────┬──────────────────────────────────┘


┌─────────────────────────────────────────────────────────────────┐
│ LLM PROCESSING │
│ │
│ Provider: OpenAI / Anthropic / Google │
│ Model: GPT-4o / Claude 3.5 / Gemini Pro │
│ │
│ The model processes all context and generates │
│ the most appropriate response │
│ │
└──────────────────────────────┬──────────────────────────────────┘


Output: "Our standard teeth cleaning is €80, and
a deep cleaning is €120. Would you like
to schedule an appointment?"

3. Knowledge Base (RAG)

Retrieves relevant information from your documents.

┌─────────────────────────────────────────────────────────────────┐
│ RAG RETRIEVAL PROCESS │
└─────────────────────────────────────────────────────────────────┘

User Question: "What are your prices?"


┌─────────────────────────────────────────────────────────────────┐
│ EMBEDDING & SEARCH │
│ │
│ 1. Convert question to vector (embedding) │
│ 2. Search document vectors for similar content │
│ 3. Retrieve top matching chunks │
│ │
└──────────────────────────────┬──────────────────────────────────┘


┌─────────────────────────────────────────────────────────────────┐
│ RETRIEVED DOCUMENTS │
│ │
│ Chunk 1: "Services and Prices: │
│ - Standard cleaning: €80 │
│ - Deep cleaning: €120 │
│ - Whitening: €200" │
│ │
│ Chunk 2: "Special offers: │
│ - First visit 10% discount │
│ - Package of 3 cleanings: €200" │
│ │
└──────────────────────────────┬──────────────────────────────────┘


Sent to LLM as context

4. Text-to-Speech (TTS)

Converts the AI's text response into natural-sounding speech.

┌─────────────────────────────────────────────────────────────────┐
│ TEXT-TO-SPEECH PIPELINE │
└─────────────────────────────────────────────────────────────────┘

Text Response ───▶ Text Processing ───▶ Voice Synthesis ───▶ Audio Output
│ │
│ │
▼ ▼
• Punctuation • Selected voice
• Numbers (€80) • Speed setting
• Abbreviations • Emotion/tone

Voice options:

  • Multiple languages
  • Male/Female voices
  • Different ages and styles
  • Adjustable speaking speed

Data Flow

What Data is Stored?

┌─────────────────────────────────────────────────────────────────┐
│ DATA STORAGE │
└─────────────────────────────────────────────────────────────────┘

┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Configuration │ │ Call Data │ │ User Data │
│ │ │ │ │ │
│ • Prompts │ │ • Transcripts │ │ • Accounts │
│ • Settings │ │ • Recordings │ │ • Workspaces │
│ • Knowledge │ │ • Metadata │ │ • Billing │
│ • Agent tools │ │ • Analytics │ │ • Teams │
│ │ │ │ │ │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │ │
└───────────────────────┴───────────────────────┘


┌─────────────────────┐
│ Secure Database │
│ (Encrypted) │
└─────────────────────┘

Data Privacy

Data TypeStorageRetentionAccess
Call recordingsEncrypted cloud storageConfigurableWorkspace admins only
TranscriptsDatabaseConfigurableWorkspace members
Knowledge BaseDatabase + Vector storeUntil deletedWorkspace members
User accountsDatabaseUntil account deletionUser + admins
AnalyticsAggregated database12 monthsWorkspace members

Integration Points

Phone Integration (Twilio)

┌─────────────────────────────────────────────────────────────────┐
│ TWILIO INTEGRATION │
└─────────────────────────────────────────────────────────────────┘

Your Twilio Account Hanc.AI
│ │
│ 1. Buy phone number │
│ 2. Connect account via API keys │
│ 3. Configure webhook to Hanc.AI │
│ │
▼ ▼
┌─────────────────┐ Incoming call ┌─────────────────┐
│ Phone Number │───────────────────▶│ Voice Agent │
│ +43 1 234 5678 │ │ "Reception" │
│ │◀───────────────────│ │
└─────────────────┘ Audio stream └─────────────────┘

Calendar Integration

┌─────────────────────────────────────────────────────────────────┐
│ CALENDAR INTEGRATION │
└─────────────────────────────────────────────────────────────────┘

When agent needs to book appointment:

Agent: "Let me check availability..."


┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Hanc.AI Agent │───▶│ Calendar API │───▶│ Google/Outlook │
│ │ │ │ │ Calendar │
│ Check Tuesday │ │ GET /events │ │ │
│ 3pm available? │ │ POST /events │ │ ✓ Tuesday 3pm │
│ │◀───│ │◀───│ available │
└─────────────────┘ └─────────────────┘ └─────────────────┘


Agent: "Tuesday at 3pm is available.
Shall I book that for you?"

Webhook Integration

┌─────────────────────────────────────────────────────────────────┐
│ WEBHOOK EVENTS │
└─────────────────────────────────────────────────────────────────┘

When specific events occur, Hanc.AI sends data to your systems:

Event: Call Completed


┌─────────────────┐ ┌─────────────────┐
│ Hanc.AI │ POST │ Your Server │
│ │────────▶│ │
│ { │ │ • Update CRM │
│ "event": │ │ • Send email │
│ "call_ended",│ │ • Log data │
│ "duration": │ │ • Trigger │
│ 165, │ │ workflow │
│ "transcript":│ │ │
│ "..." │ │ │
│ } │ │ │
└─────────────────┘ └─────────────────┘

Performance Characteristics

Latency Breakdown

StageTypical LatencyDescription
STT Processing200-500msConverting speech to text
LLM Processing500-1500msAI generating response
RAG Retrieval100-300msSearching knowledge base
TTS Generation200-400msConverting text to speech
Total1-3 secondsEnd-to-end response time

Scalability

The platform handles:

  • Concurrent calls: Hundreds of simultaneous conversations
  • Knowledge base size: Millions of document chunks
  • Global availability: Multi-region deployment

Security Architecture

┌─────────────────────────────────────────────────────────────────┐
│ SECURITY LAYERS │
└─────────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────────┐
│ Authentication Layer │
│ • Firebase Authentication │
│ • Session tokens (HttpOnly cookies) │
│ • Phone verification │
└─────────────────────────────────────────────────────────────────┘


┌─────────────────────────────────────────────────────────────────┐
│ Authorization Layer │
│ • Workspace-based access control │
│ • Role-based permissions │
│ • API key scoping │
└─────────────────────────────────────────────────────────────────┘


┌─────────────────────────────────────────────────────────────────┐
│ Data Protection Layer │
│ • Encryption at rest (AES-256) │
│ • Encryption in transit (TLS 1.3) │
│ • Data isolation between workspaces │
└─────────────────────────────────────────────────────────────────┘

Summary

The Hanc.AI platform combines multiple technologies:

  1. Voice Processing — Real-time speech-to-text and text-to-speech
  2. AI Intelligence — Large Language Models for understanding and response
  3. Knowledge Retrieval — RAG system for business-specific information
  4. Telephony — Phone number management and call routing
  5. Integrations — Calendars, CRMs, and custom webhooks

All these work together seamlessly so you can focus on configuring your agent's personality and knowledge, while the platform handles the technical complexity.


Next Steps