Design a Multi-Tenant AI Receptionist for Voice and Chat
System DesignModel answerLast updated
Design a platform where businesses deploy an AI receptionist over phone and chat, using approved knowledge, permitted actions, and live human handoff.
Background
A SaaS company wants to offer small and mid-sized businesses a branded AI receptionist. Callers can reach it by dialing a business's phone number, or by opening a chat widget on that business's website, mobile app, or messaging channel. The receptionist answers questions using content the business has approved, carries out permitted tasks on the customer's behalf, and transfers the conversation to a live agent whenever the situation calls for it.
Each business is an independent tenant with its own configuration, knowledge, and staff queue. No tenant should be able to see or affect another's data.
Scope: Define it first
No traffic numbers or latency budgets are provided. Before jumping into components, establish your assumptions:
- Roughly how many concurrent conversations are you targeting?
- What latency is acceptable for a voice turn-around vs. a chat reply?
- Are all businesses guaranteed to have a staffed agent queue, and what happens at 2 a.m.?
Interviewers expect you to state these assumptions explicitly before designing to them.
Clarifying questions worth raising
- Which operations can the receptionist perform autonomously, and which need explicit customer confirmation or a human to approve?
- How does a business owner submit, review, and publish updates to their knowledge base, hours, and escalation rules?
- Must a customer's history be visible across channels — e.g., does a follow-up chat show what was discussed on yesterday's call?
- How should the system behave if no agent is available when a handoff is requested?
Part 1 — Channels and conversation state
Walk through how voice calls and chat messages enter the platform, how sessions are created and maintained, and how responses flow back to the customer.
Your answer should address:
- Channel-specific adapters that normalize different protocols into a shared session model, without losing timing-sensitive behavior unique to voice (silence, interruptions, barge-in).
- How an incoming contact is matched to the correct tenant and, when available, to an authenticated or identified customer record.
- Real-time transcription and speech synthesis for voice, partial/streaming message handling for chat, and how both are stored in a unified conversation history.
Part 2 — Knowledge, configuration, and actions
Explain how the receptionist is constrained to approved information and authorized operations.
Your answer should address:
- How business-specific content (FAQs, policies, hours, product catalog) is versioned and served, so a configuration rollback doesn't expose stale or conflicting answers.
- How the AI retrieves and grounds its responses in tenant-approved content, detects uncertainty, and declines or escalates when a request falls outside its approved scope.
- How permitted actions (booking an appointment, looking up an order, sending a confirmation) are defined as typed contracts, authorized per tenant, confirmed with the customer when appropriate, executed idempotently, and logged for audit.
Part 3 — Handing off to a human agent
Describe the full escalation path: from the moment a handoff is triggered to the moment a live agent takes over response authority.
Your answer should address:
- How the platform queues the conversation for an available agent and delivers the full transcript and context at the moment of acceptance.
- How voice bridging or chat re-routing works once an agent accepts, so the customer experiences a seamless transition.
- The ownership handover as an atomic operation: the bot must stop generating replies the instant an agent takes control, with no window where both reply simultaneously.
- What happens when no agent is available — after-hours behavior, callback scheduling, or async messaging.
Hints
Hint 1
Start by scoping: pick a concrete concurrency target (e.g., 10,000 simultaneous conversations) and a per-turn latency budget (e.g., <800 ms for voice, <2 s for chat), then let those numbers drive your component choices rather than listing components first.
Hint 2
Treat 'answering a question' and 'executing an action' as fundamentally different control paths. Questions go through a retrieval-and-grounding pipeline; actions go through an authorization check, a typed contract, customer confirmation, and an idempotent executor. Mixing the two is a common design mistake.
Hint 3
The human handoff is not a redirect — it's an ownership transfer. Model it as an atomic state change on the session (bot_active → agent_active) and make sure every reply-generation path checks that flag before sending, so the bot cannot race an agent on the same turn.
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Scoping first
Before drawing any boxes, nail down assumptions. A reasonable starting point: 10,000 concurrent conversations, voice turns under 800 ms end-to-end (transcription + inference + synthesis), chat replies under 2 seconds. Agent queues are per-tenant and may be unstaffed outside business hours, so the platform needs an after-hours fallback that doesn't just hang up. Cross-channel history is a day-one requirement because customers are frustrated when they have to repeat themselves.
Part 1 — Channels and conversation state
Channel adapters
Voice arrives via a telephony provider (Twilio, Vonage) over SIP or WebSocket. Chat arrives over WebSocket or webhooks from web, mobile, and third-party messaging channels. Each protocol is handled by a thin channel adapter whose only job is to normalize the signal into a canonical event (CustomerUtterance, CustomerMessage) and forward it to a shared Conversation Orchestrator. The adapter also owns the return path — synthesizing TTS for voice, emitting text frames for chat — so the orchestrator never speaks a protocol directly.
Voice adapters must handle barge-in: when the customer speaks while the bot is still playing audio, the adapter sends a BotInterrupted event, the orchestrator cancels the in-flight TTS stream, and a new turn begins immediately. Chat adapters deal with partial typing indicators rather than interruption, but the pattern is symmetric.
Session and tenant routing
When a contact arrives, the platform looks up the tenant by the DNIS (the dialed number) or by the origin domain of the chat widget. A session record is created with a tenant ID, channel type, session ID, and — if available — a resolved customer identity (matched by caller ID, authenticated token, or cookie). Tenant isolation is enforced at this layer: the session carries a tenant-scoped credential that all downstream services check before returning any data.
Conversation history is stored per-session in a fast store (Redis for hot turns, a durable append-only log for the full transcript). A cross-channel history service links sessions belonging to the same customer across channels, keyed by verified identity rather than device.
Part 2 — Knowledge, configuration, and actions
Versioned business configuration
Each tenant has a configuration snapshot: approved knowledge (documents, FAQs, policies), permitted actions, business hours, escalation rules, and tone/persona settings. Snapshots are versioned and published explicitly; the active session always reads a pinned snapshot version so a mid-conversation publish can't change the bot's behavior mid-turn. Rollback is just pinning to a prior version.
Grounded retrieval
When the orchestrator needs to answer a question it calls a Retrieval service that performs semantic search over the tenant's approved corpus. Retrieved chunks are assembled into a grounding context and passed to the LLM with a strict prompt: answer only from the provided content, state uncertainty when the content is insufficient, never fabricate. A lightweight response quality evaluator scores the output for factual grounding and flags low-confidence replies for soft escalation ("Let me check with a colleague") rather than hallucination. Requests that fall entirely outside the approved scope are declined politely and logged.
Action execution
Actions are completely separate from answers. Each permitted action is declared as a typed contract: name, parameters, required permissions, customer-facing confirmation template, and the downstream API it calls. The orchestrator routes action intents to an Action Executor that:
- Checks the action is in the tenant's allow-list.
- Checks the customer has permission (authenticated, account in good standing, etc.).
- Renders a confirmation to the customer and waits for an affirmative response.
- Executes the action with an idempotency key derived from session ID + action + intent fingerprint, so retries don't double-book an appointment.
- Writes a structured audit record regardless of outcome.
The confirmation step is omitted for read-only lookups (checking an order status) and required for mutating operations (canceling a reservation). Which is which is declared in the contract, not hardcoded.
Common mistake: letting the LLM decide whether a confirmation is needed. The contract declares it deterministically.
Part 3 — Human handoff
Triggering escalation
Escalation triggers are: explicit customer request, low-confidence action, repeated failed disambiguation, or a business rule (e.g., complaints always escalate). When triggered, the orchestrator transitions the session to PENDING_AGENT and enqueues it in the tenant's Agent Queue with priority metadata (urgency, topic, customer tier).
Ownership as an atomic transition
The session carries an owner field: BOT or AGENT:<agent_id>. Every path that generates a reply reads this field under a lock before sending. When an agent accepts the queue item, the platform performs a compare-and-swap: BOT → AGENT:<id>. If the CAS fails (another agent already accepted), the first agent's acceptance is rejected. Once the CAS succeeds:
- Voice: the telephony adapter bridges the call leg to the agent's SIP endpoint. The customer hears hold music for the ~1–2 seconds the bridge takes; the bot does not speak again.
- Chat: the chat session is re-routed to the agent's console. The agent sees the full transcript including bot turns, retrieved knowledge chunks used, and any action history.
Any in-flight bot response generation is cancelled upon the ownership change. There is no window where both reply.
After-hours and no-agent fallback
If the queue has no available agents (outside hours, queue full), the platform offers the customer a choice based on tenant configuration: leave a voicemail/message for async follow-up, schedule a callback at a specific time, or continue with the bot in a limited mode. Abandoning the customer with silence or a busy signal is not an option — the after-hours path is a first-class configuration item, not an error handler.
Trade-offs to call out
- Shared LLM vs. per-tenant fine-tuned models: shared is operationally simpler and cost-effective; per-tenant fine-tuning improves tone fidelity but multiplies model hosting cost. A middle path is prompt-level persona injection with shared inference.
- Synchronous vs. async action execution: synchronous keeps the conversation flowing but ties up a session thread. For slow downstream APIs, async execution with a "I'm processing that, one moment" holding message is better UX.
- Cross-channel history scope: sharing full history improves continuity but requires strong identity verification — you don't want a caller who guesses a phone number to see a different customer's chat. Gate cross-channel linking on verified identity only.