Add a click-to-talk AI receptionist to an existing website

TL;DR
Add a click-to-talk receptionist to an HTTPS page, interrupt a spoken reply, and connect one backend action. A recorded test shows how to verify that a visitor heard confirmation after exactly one enquiry was saved.
Sponsored by PyAI. This post was paid for by the sponsor and reviewed by Developers Digest before publishing.
A visitor asks whether your product handles appointment reminders. Halfway through the answer, they interrupt with a narrower question. Then they ask you to save an enquiry. Getting a button onto the page is the easy part. How do you know the old answer stopped playing, or that the receptionist actually saved anything?
We built this flow at PyAI for Lantern Desk, a fictional appointment-reminder service. You can listen to the recorded browser session before setting anything up. Use the recording player on that page. The separate Talk button opens a live cloud session and asks for microphone access.
Give the receptionist a small job#
Start in a test project. Run whoami through PyAI MCP and check the project ID, environment, billing and usage limits before starting a session. In the PyAI console, create or select a voice agent. Give it a few facts a reader can check. Our example says Lantern Desk sends appointment reminders, the service supports teams of up to ten and the fictional visitor has four people on their team. Ask the agent to answer briefly and yield when interrupted.
Put those facts directly in the saved agent profile for this exercise. That makes the first test easy to interpret. If the assistant says it supports twenty people, you can check the answer against a single source. Leave the save action disconnected until the basic conversation works.
Put the published widget on your page#
Open Agents → Website & phone. Add the exact HTTPS origin that serves your page, including the port if you use a nondefault one. The preview and production hosts may have different origins. Set a daily limit for the whole widget and a daily limit per IP, preview the settings, then publish. Those limits count session starts. Session duration can vary, so evaluate billing separately if your project needs a hard spending limit.
Copy the published embed snippet and paste it near the end of the page body. The minimal page in the walkthrough shows the complete example. In our test the script was https://cdn.pyai.com/widget/v12.1/pyai-widget.js, and its data-widget attribute held the public widget ID. The page needs no project API key. If you enforce a Content Security Policy, use the example server's script, style nonce and connection settings as a reference. Widget setup guide
Load the page over HTTPS from the allowed origin. Clicking the button and allowing microphone access sends visitor audio to PyAI for processing. Tell visitors that before they start. If the button appears but the session cannot start, check the actual browser origin, microphone permission and remaining session allowance first.
Let the visitor interrupt#
Ask, “What does Lantern Desk do? Can it help with appointment reminders?” While the product answer is still audible, interrupt with “Wait, stop. Tell me only how many people are on our team.” Listen for the product explanation to cut off, followed by the answer about four people. A transcript alone can hide a playback bug. It can show the right second answer while the browser is still playing the first one.
In our corrected Chromium run, the browser cancelled its queued output 250 milliseconds after the synthetic interruption began. Almost two seconds of the first response were still queued. That timing describes one browser run in Google Cloud's us-central1 region with prerecorded US-English input. The recording lets you judge the transition yourself. Measurements and transcripts
Give one backend action a receipt#
Register a server tool named save_lantern_demo_enquiry and bind it to the agent. Point it at your backend's HTTPS /api/managed-enquiry endpoint, select server execution and mark it as an action. Configure a dedicated credential in the tool's X-Lantern-Demo-Key header. The example server checks that credential against a configured digest and verifies the agent ID. Keep the credential on the server side. Server tool setup
For the first integration, accept just three arguments. The example requires team_size to equal 4, needs_reminders to be true and confirmed to be true. Instruct the receptionist to wait for the visitor's express request to save. The visitor can ask all the product questions they like before that point.
Here is the part worth copying into a real integration. The backend derives a receipt from the agent ID and the tool's call ID. It creates one private record under that receipt. If the same invocation arrives twice, the storage adapter reads the existing record. The handler returns success: true only when storage reports a save with the expected receipt. If the outcome is uncertain, inspect that receipt before issuing another request.
Check what the visitor heard against what was stored#
On our first attempt the enquiry was saved, but the visitor heard “I couldn't confirm that the requested action completed.” The webhook had returned saved: true without the explicit success signal the agent needed. Retrying the conversation could have created a second enquiry. Reading the first receipt exposed the actual problem and let us fix the acknowledgement.
In the corrected run, the visitor interrupted, heard the answer about their four-person team and explicitly asked to save. Storage showed one new fictional enquiry. Only then did the visitor hear the confirmation. From an empty site directory, that complete result took 13 minutes 35 seconds, including the acknowledgement fix. The test project, agent, published widget and HTTPS origin already existed. For your own acceptance test, keep the recording alongside the single stored record that backs the promise.
Get the next deep dive like this in your inbox
One email a week on Sponsored and the rest of the AI dev stack. Free.
Read next
Claude Code Cross-Session Messaging: Your Agents Can Now Talk to Each Other
Claude Code v2.1.224 lets one running session message another over a first-party channel - plain text, permission-aware, with approval dialogs when bypass-mode sessions talk to each other. Here is what ships, how delivery and inbound controls work, and where the feature stops.
7 min readClaude API Inline Tool Definitions: Add Tools Mid-Conversation
Claude API inline tools beta: define, reshape or upgrade a tool mid-conversation with one system message and keep the prompt cache. Code included.
11 min readHow to Keep API Keys Away From Your AI Coding Agent: Claude Code vs Codex vs Cursor vs Gemini CLI
A deny rule on .env stops cat but not a Python one-liner. Here are the three layers that actually keep secrets out of a coding agent's context - file rules, environment scrubbing and credential masking - and what Claude Code, Codex, Cursor and Gemini CLI give you for each, with real test runs.
12 min readNew here? Start with