The design we start from for an AI agent that answers your business line, books or looks things up through your systems, and puts the caller through to a person with a summary when it should. It is a reference design, not a client system. Cost per minute and consent rules live in the voice agent buyer’s guide; the Twilio behaviour this page relies on is cited with the date we checked it.
The caller’s audio arrives over a media stream and is transcribed as it streams. At the end of the turn the model replies, calling a calendar tool, and text to speech plays the answer back on the same stream, where barge-in can clear it. A warm transfer to the front desk waits as a branch, and the call record is written when the call ends.
The problem
What this architecture solves
A phone call is the least forgiving channel. The caller cannot see a typing indicator, talks over the agent, mumbles a date and hangs up after a few seconds of silence. An inbound voice agent is a loop that runs once per caller turn, under a tight time budget, with a person one transfer away. Most of the engineering goes into turn-taking, interruptions and the transfer, not the model.
The caller hears a reply quickly enough that the call never feels broken.
Talking over the agent stops its speech at once.
Anything outside the agent’s job reaches a person with a summary, never a cold transfer.
Every call leaves a record: transcript, outcome, consent and what was booked.
Components
Components and the options for each
Telephony and number
Answers your number, applies business-hours and fallback rules, and opens a media stream to the agent.
Twilio Programmable Voice
Your existing number, ported or forwarded
Media stream bridge
A WebSocket service holding the call’s live audio in both directions; it can clear queued audio the moment the caller speaks.
Twilio bidirectional Media Streams
Twilio ConversationRelay (Twilio handles speech)
Speech to text
Streams partial transcripts while the caller talks, tuned for names, dates and your product terms.
A streaming speech-to-text model
Speech handled by the relay
Turn detector
Decides that the caller has finished, rather than paused mid-sentence, from silence and the partial transcript.
Silence plus transcript rules
Model-based end of turn
Dialogue model and tools
Holds the call state, answers from approved content and calls narrow tools: find a slot, book it, look up a booking.
OpenAI
Anthropic
Google Gemini
Text to speech
Turns each reply into audio in short chunks, so the first words play while the rest is generated.
A streaming voice model
Speech handled by the relay
Transfer rule
Code that decides when a person takes over: the caller asks, an emergency word, a repeated misunderstanding or a task outside scope.
Warm transfer with a summary
Callback task in your CRM
Call record
Transcript, outcome, consent answer and booking reference, kept for your retention period.
Supabase
Cloudflare D1
Your CRM via its API
Data flow
How data moves, step by step
01The call reaches your number; business-hours rules decide whether the agent answers.
02The agent says it is an AI assistant, and the media stream starts.
03Speech to text streams partial transcripts while the turn detector waits for the end of the turn.
04The dialogue model replies, calling a tool such as a slot lookup when it needs one.
05Text to speech plays the reply in chunks; if the caller talks over it, queued audio is cleared and the loop listens again.
06When the transfer rule fires, the agent tells the caller and puts them through with a summary.
07When the call ends, the record is written and any confirmation goes out on the channel the caller agreed to.
How it works
Design decisions
Mechanism 01
Interruptions stop the agent
Callers talk over agents all the time. The bridge keeps listening while the agent speaks; when the caller starts, it sends Twilio’s clear message, which empties the buffered audio, and the model receives the interruption as part of the next turn.
What's the alternative? Ignore speech while the agent talks
Simpler, and callers end up shouting over a voice that will not stop.
Mechanism 02
Short replies, streamed
Delay adds up across every stage. Replies are kept to a sentence or two, the first audio chunk plays while the rest is generated, and a slow tool gets a spoken filler (“let me check that”) instead of silence.
What's the alternative? Generate the whole reply, then speak
Easier to log, and the pause before every answer makes the call feel broken.
Mechanism 03
Transfer is a rule, not a mood
The model can suggest a transfer, but code decides: an explicit request, an emergency word, two failed attempts at the same detail, or anything outside the task list. The person hears a short summary before the caller is connected.
What's the alternative? Let the model decide when to transfer
Polite and inconsistent: some callers loop, others are transferred for no reason.
Reference diagram
The whole design on one diagram
Drawn to the same legend as our other reference architectures, so you can compare them box for box.
System of recordCall recordTranscript, outcome, consent
An incoming call opens a media stream; speech to text and a turn detector pass each complete turn to the dialogue model, which calls booking tools on your calendar and sends reply text to text to speech for the caller. A transfer rule hands the call to the front desk with a summary, and the call record keeps transcript and outcome.
Diagram with 12 parts: Incoming call (source), Media stream (processing), Speech to text (model), Turn detector (control), Dialogue model (model), Booking tools (processing), Text to speech (model), Transfer rule (control), Your calendar (system of record), Caller (human), Front desk (human), Call record (system of record).
Connections:
Incoming call → Media stream (call audio)
Media stream → Speech to text (caller audio)
Speech to text → Turn detector (partial text)
Turn detector → Dialogue model (complete turn)
Dialogue model → Booking tools (tool call)
Booking tools → Your calendar (booking)
Dialogue model → Text to speech (reply text)
Dialogue model → Transfer rule (transfer intent)
Text to speech → Caller (audio)
Transfer rule → Front desk (summary + call)
Your calendar → Call record (booking reference)
How to read these diagrams
Source· in this diagram
Where a request or data enters: a chat widget, a WhatsApp message, a phone call, a webhook, a schedule or an approved document set.
Processing· in this diagram
Ordinary code we write and test: ingress endpoints, routing, retrieval, queues, workers and tool calls. It behaves the same way every time.
Model· in this diagram
A language, speech or embedding model call. Its output is treated as a draft and checked before it can reach a customer or a system.
Control· in this diagram
A gate that can stop, hold or reroute work: input checks, citation checks, send rules, transfer rules and dead letters.
Human· in this diagram
A customer or someone on your team. An arrow into a person is the answer, the escalation or the approval path.
System of record· in this diagram
Where state lives and survives a restart: your CRM, helpdesk or calendar through its API, a search index, a log.
→Arrows run in the order data moves: left to right, or top to bottom on a phone.
→A label on an arrow names what travels along it, such as a question, an event id or a ticket.
→Named products are options from our build stack; “your … via its API” means the system you already run.
→Each diagram is a reference design, not a drawing of any client’s system. Component choices are made per project.
What happens when a caller talks over the voice agent?
The agent stops. The bridge listens while the agent speaks, clears the queued audio as soon as the caller starts, and passes what they said into the next turn, so the conversation carries on from the interruption.
How does the agent know the caller has finished speaking?
A turn detector combines the length of the silence with the partial transcript: a pause after “I’d like to book for” waits longer than a pause after a full sentence. The setting is tuned for each line from reviewed calls.
What does the person taking a transferred call hear first?
A short summary before the caller is connected: who is calling, what they want and what the agent has already done, such as the slot it offered. The caller is told they are being put through, so nobody repeats themselves.
Where does the delay before each reply come from in this design?
From stages in series: end-of-turn detection, the model’s first words, any tool call and the first chunk of speech. We time each stage on every turn and stream the first sentence while the rest is generated; the buyer’s guide has the full latency budget.
Can we start with after-hours calls only?
Yes, and it is the rollout we suggest. The agent answers while the office is closed, books what it can confirm and leaves callbacks for the rest; daytime overflow comes once reviewed calls show it handles your top call reasons.
Does the agent need our booking system to have an API?
For live booking, yes: the tools find and hold slots through your calendar or practice system’s API. Without one, the agent takes a structured request and creates a callback task, and a person confirms the booking.
Next step
Have a workflow in mind? Let’s scope it together.
Book a free 30-minute strategy call. Bring one process you want to automate and we will talk through scope, integrations and a sensible first step.