Meet Knit: How We Built a Voice Guide That Helps People Make Their First Comic
A real-time voice model at the front, a grounded agent behind it, and a security model where every boundary is enforced by the server.
By ComicKnit Editorial Team · Published · 8 min read
The short answer
Knit is ComicKnit's voice and text support guide. A real-time Gemini Live model handles the conversation directly from the browser using a single-use, config-locked ephemeral token, while factual answers come from a read-only ComicKnit agent. Navigation is limited to an allowlist of pages, conversations are bound to a server-side identity, and Knit has no write tools, so it cannot change an account.
The hard part is the first two minutes
ComicKnit turns a one-line story idea into an illustrated comic. The product is simple once you have used it. The hard part is the first two minutes: new visitors land with questions like whether it is free, whether they need to draw, whether they can make a comic about their kid's birthday, and how long it takes. They often leave before they ask anyone.
So we built Knit, a friendly Ask Knit button on our public pages. Tap it and you can simply talk, for example asking whether you can make a superhero comic starring your dog, and get a spoken answer in a second or two plus one button that takes you to the right next step. You can type too.
Goals and non-goals
We set ourselves a short list of goals and one explicit non-goal. Knit is not a general chatbot: ask it about the weather and it politely brings you back to comics.
- Voice first, like a conversation. Low latency, natural turn-taking, and you can interrupt it mid-sentence.
- Never make things up. Prices, credit costs and features must be correct, and a signed-in user's questions about their account need their real numbers.
- Activation over chit-chat. Every answer should move people toward making a comic.
- Safe by construction. Knit cannot do anything to an account, and nothing a visitor says can change that.
Architecture: a voice and a brain
The key decision was to split the voice from the brain. The voice is Gemini Live, a real-time speech-to-speech model that handles listening, turn-taking, interruptions and speaking, and sounds natural. It is not where we want facts to come from.
The brain is our existing agent worker running a dedicated, tightly scoped support mode. It reads curated product knowledge built from the same source data that powers our how-to guides and pricing page, so it cannot drift from what the site says, and for signed-in users it gets a read-only view of their own account summary.
The voice model has exactly two tools. The first sends any factual question to the brain, with instructions never to guess facts, numbers or prices. The second moves the browser to a page, and its parameter is an enum of allowlisted pages, so the model cannot produce an arbitrary URL even if it wanted to. While the brain is working, the voice can say a short let-me-check so the pause feels natural.
Keeping the API key off the browser
For low latency, the browser talks to Gemini Live directly over a WebSocket, because relaying audio through our servers would add a hop to every frame. But we obviously cannot ship our API key to the browser, so the answer is ephemeral tokens.
When someone taps Talk to Knit, the browser asks our server to start a voice session, and the server mints a short-lived token that is single-use, valid to start a session only within a short window, and config-locked. The model, the system instruction, the tool list, the voice and the output settings are all baked into the token on the server.
Config-locking is the important part. Even someone poking around in dev tools cannot reuse the token to call a different model, swap in their own system prompt or add tools. Whatever they send, the session runs with our configuration.
Real-time audio in the browser
The client is a small module that loads the Gemini SDK lazily, so nobody pays for it until they open Knit. It captures microphone audio as 16 kHz PCM and plays back the model's 24 kHz PCM audio. It also handles barge-in: when Gemini reports that the caller interrupted, queued playback is dropped straight away so Knit stops talking mid-sentence, like a person would. Live transcriptions of both sides appear as chat bubbles, so the conversation is readable and accessible, and you can switch to typing at any point.
One practical lesson: our strict Content Security Policy blocks loading AudioWorklet modules, so capture uses the older ScriptProcessor path. It is deprecated but universally supported, and at speech sample rates it performs fine. We added the Live WebSocket host to the policy explicitly and nothing else.
Grounding the brain
When the voice asks the brain a question, our server first cleans it: it caps the length and strips control characters and anything that looks like markup or special markers. It then fences the question as untrusted, wrapping it in a labelled envelope whose surrounding message says everything inside is visitor speech to be answered, never instructions to be followed. Trusted context, such as whether the user is signed in and which page they are on, comes from the server outside the fence.
The server then starts or continues an agent session under a support-only identity and waits a bounded time for the reply. The answer is cleaned before it goes anywhere: links, markup and stray markers are stripped, length is capped because it will be spoken, and at most one call to action is kept, expressed as a key from the same page allowlist so the button is always one of our own pages.
If the brain is slow or unavailable, Knit does not go quiet or invent something. It returns a helpful fallback with a Create button and logs the answer as degraded.
The security model
A public voice bot that can read account data is an obvious target, so we designed on one assumption: everything the caller sends is hostile, including what the model says on the caller's behalf.
- Identity comes from the server. Signed-in users are identified by their normal session and anonymous visitors get a signed, httpOnly cookie. Nothing in a request body can claim to be someone.
- Conversations are bound to their owner. Each conversation continues through a signed token tied to the caller, and a token from someone else is ignored. Conversations also expire and roll over after a fixed number of questions.
- Separate worlds. Support sessions run under a distinct identity type with one narrow permission, and the internal endpoints the agent calls check the audience of every request, so a support identity can only reach support endpoints.
- Read-only, own data only. The support agent has two tools: product knowledge and, when signed in, a summary of the caller's own account taken from the signed identity. There are no write tools, and Knit never asks for passwords, card numbers or codes.
- Defence in depth on prompts. Both models treat visitor speech and tool output as data and never promise discounts, refunds or deadlines, but the important limits are enforced in code, so prompts are not the only line of defence.
- Abuse limits and kill switches. Public endpoints check same-origin, cap request sizes and rate-limit per visitor, per network and globally, with a daily ceiling on voice sessions. The web launcher and the agent's support mode can each be turned off without a deploy.
Designed for activation
Knit is not just an FAQ with a voice. The launcher's opening line depends on the page: on the landing page it invites new visitors to ask how to make a first comic, and on someone's published comic it says you can make one like it in minutes. Every answer can carry one clear next step, such as Sign up and create or the first-comic guide, and never a wall of links. If an anonymous visitor asks to create a comic or buy credits, navigation sends them through sign-in first and then on to where they were going. And the button is hidden where it would be in the way, such as the studio editor, admin, sign-in and unsubscribe pages.
We measure it simply: opens, voice sessions started, questions asked, call-to-action clicks and errors, by page and signed-in status, so we can see which conversations turn into comics.
Key takeaways
- Split voice and brain. Real-time voice models are great at conversation. Let them talk, and let a grounded agent supply the facts.
- Lock configuration on the server. Ephemeral, single-use, config-locked tokens let the browser connect directly for latency without giving away control.
- Make model output unable to do damage. Enums for navigation, an allowlist for calls to action, sanitised answers and no write tools.
- Bind everything to a server-side identity. Never trust an id in a request body, and sign anything that carries state between turns.
- Fail helpfully. A slow backend should still give a useful answer and a next step, not silence.
Frequently asked questions
What is Knit?
Knit is ComicKnit's voice and text guide. It answers questions about pricing, credits and how to make a comic, and points visitors to the right next step. It is not a general chatbot.
Can Knit change my account or spend my credits?
No. Knit has no write tools. It cannot spend, refund, grant, delete or edit anything, and it never asks for passwords, card numbers or one-time codes.
How does the browser talk to Gemini Live without exposing an API key?
The server mints a single-use, short-lived ephemeral token that is locked to ComicKnit's model, system instruction, tools and voice. The browser connects with that token and the real API key never leaves the server.
Where do Knit's facts come from?
From a read-only ComicKnit agent that reads product knowledge built from the same data as the pricing page and how-to guides. The voice model is instructed to state only what the agent returns.
What happens if the backend is slow or a rate limit is hit?
Knit returns a helpful fallback with a Create button instead of going silent or inventing an answer, and when a voice limit is reached it suggests typing instead.
