Writing three client emails after calls usually eats forty minutes: digging up notes, recalling details, and polishing drafts. With a voice assistant that sees your screen and stops talking mid-word, the job takes two minutes. There is just one rule: don't mix live conversation and long-form writing in the same session. A fast voice layer gives short replies while a background sub-agent handles heavy file work.
Why Old Voice Bots Feel Like Walkie-Talkies and What Gemini Live API Changes
Standard voice bots trap you in a frustrating loop. You ask a question, the model reads three off-target paragraphs, and you have to wait for it to finish. You can't interrupt. Those bots are stitched together in a cascade: speech-to-text (STT), LLM reply, and text-to-speech (TTS). It feels like an old walkie-talkie—until the other side lets go of the button, your words go nowhere.
The Gemini Live API removes that cascade. Instead of three separate requests, it opens one bidirectional WebSocket (WSS) connection carrying a direct speech-to-speech stream, where the model takes in and outputs audio without converting through text. Input accepts raw 16-bit PCM audio (16 kHz) and JPEG/PNG screen frames up to 1 fps; output streams 24 kHz PCM voice.
Gemini Live API overview diagram: streaming audio, video, and text exchange (Source: ai.google.dev)
The biggest win is barge-in, where the assistant stops mid-syllable the moment you speak. Server-side voice activity detection (VAD) hears you say 'shorter,' cuts off generation, and sends an interrupted flag while the client clears its audio buffer. A quick correction takes two seconds instead of sitting through a 30-second monologue.
The base model here is gemini-3.8-live (Stable since September 2026, replacing gemini-3.1-flash-live-preview), while the Live API protocol itself remains marked Preview under v1beta. There is also gemini-3.8-live-extended-thinking for deeper reasoning, though voice workflows stick to the base model for minimal latency.
Two-Layer Design: Fast Voice Up Front, Background Sub-Agent on Drafts
Picture an office dispatcher wearing a headset. You toss over a task in two sentences, they confirm the details on the spot, and they hand the long document to a colleague in the next room so the phone line stays open. A voice AI assistant works the exact same way.
A client's website is open on your screen. The vision module streams screenshots at 1 fps—enough to read pages without clogging the connection. A browser tool checks what AI chatbots say about the brand, while the assistant pulls two text files from a local folder (an AI-visibility checklist and an email style note). As the model starts reading findings aloud, you cut in: 'Keep it brief, send the email draft to the sub-agent.'
That triggers the sub-agent: a background worker that reads large files and writes drafts while the voice layer keeps talking with you. In gemini-3.8-live, async function calls (behavior: NON_BLOCKING) are enabled by default, unlike gemini-3.1-flash-live-preview which used to freeze during tool calls. You control how results return with scheduling: INTERRUPT (speak right away), WHEN_IDLE (wait for a pause), or SILENT (stay quiet). While you move on to the next website, the worker writes a four-line email and drops it in the client's folder.
To keep the voice layer from turning into a radio broadcast, set a 25-word cap per reply in your system instruction. One or two sentences keep the pace brisk and save context space (131,072 input and 65,536 output tokens). Reviewing three calls pays off right away: the assistant grabs meeting notes and your brand voice file, you interject mid-sentence with 'mention the workbook for Tom,' and two minutes later three drafts are ready.
Plain-Text Memory Files and Proof Checks for Routines
A personal assistant doesn't need a vector database. A local 'second brain' folder full of plain .md and .txt files is far more reliable, easy to edit by hand, and portable across any tool.
| Folder | Contents | Role in Workflow |
|---|---|---|
Context Wiki | About Me, Brand Voice, offer, FAQ | Core context and tone |
Projects | One folder per client or project | Notes and drafts |
Research | Collected notes and checklists | Grounded facts |
Agents | Sub-agent instructions and schedules | Background tasks and routines |
Skills | Input → output recipes | Reusable workflows |
Updating memory by voice is effortless. If a draft feels too long, you just say: 'Remember: keep replies under three lines and include the lesson link.' The rule gets saved to a file, and after a dozen corrections the assistant holds your style on its own.
Background routines like a morning summary often suffer from silent failures you don't notice for two weeks. A proof check fixes that: the task must create an output file. It only gets a green status after verifying the file exists and isn't empty; otherwise the routine flags an error.
Python SDK Setup, Real Costs, and Safety Rules
The skeleton runs on Python 3.10+. Grab a key in Google AI Studio, store it in GEMINI_API_KEY, and install google-genai: pip install google-genai.
Starting in SDK v3+, the client defaults to v1, so you must pass v1beta for the Live API. Tools don't execute automatically here: you catch response.tool_call manually and send results back with session.send_tool_response().
import asyncio
from google import genai
from google.genai import types
# SDK v3+ defaults to v1; Live API requires v1beta
client = genai.Client(http_options={"api_version": "v1beta"})
runner_tool = {
"name": "delegate_to_runner",
"description": "Hands a draft task to the background sub-agent.",
"behavior": "NON_BLOCKING",
"parameters": {
"type": "object",
"properties": {"task": {"type": "string"}},
"required": ["task"],
},
}
cfg = types.LiveConnectConfig(
response_modalities=["AUDIO"],
system_instruction="Max 25 words. Send writing to delegate_to_runner.",
tools=[{"function_declarations": [runner_tool]}],
context_window_compression=types.ContextWindowCompressionConfig(
sliding_window=types.SlidingWindow(),
),
session_resumption=types.SessionResumptionConfig(handle=None),
)
async def main():
async with client.aio.live.connect(
model="gemini-3.8-live", config=cfg
) as session:
# Send 16 kHz PCM audio and 1 fps JPEG frames via
# session.send_realtime_input(audio=..., video=...)
await session.send_client_content(
turns=types.Content(
role="user",
parts=[types.Part(text="Check the site and hand off the draft.")],
)
)
async for resp in session.receive():
if resp.go_away:
print(f"Closing in: {resp.go_away.time_left}")
upd = resp.session_resumption_update
if upd and upd.new_handle:
saved_handle = upd.new_handle # valid for 2 hours
if resp.server_content and resp.server_content.interrupted:
print("[Barge-in: stop audio]")
if resp.tool_call:
out = [
types.FunctionResponse(
id=fc.id,
name=fc.name,
response={"result": f"In progress: {fc.args}"},
)
for fc in resp.tool_call.function_calls
]
await session.send_tool_response(function_responses=out)
asyncio.run(main())
This code handles two Live API limits. Without compression, an audio session lasts 15 minutes and a screen-sharing session lasts 2 minutes; context_window_compression turns on session context compression (SlidingWindow) to lift that cap. The underlying WebSocket still drops roughly every 10 minutes: the server sends a GoAway warning ahead of time, and the new_handle token from session_resumption stays valid for two hours for seamless reconnection.
Now for the price tag. gemini-3.8-live has a Free Tier, yet Google may use Free Tier requests to improve models, so keep work folders on the Paid Tier (text runs $0.75 per 1M input tokens and $4.50 per 1M output tokens, and data isn't used for training). For voice, the main cost driver is stream duration.
gemini-3.8-live pricing (Paid Tier): cost per stream minute
Model speech costs noticeably more than mic input or screen frames, so the 25-word cap protects your budget too. TURN_INCLUDES_AUDIO_ACTIVITY_AND_ALL_VIDEO is active by default, meaning it pays to turn screen streaming on only when needed. Also, the model doesn't support code_execution, url_context, structured_output, context_caching, or affective_dialog, while proactive_audio is always on—one more reason to offload heavy logic to a sub-agent.
Four Guardrails Before Going Live
- Grant the agent access to one 'second brain' folder only, never your entire drive.
- Keep
GEMINI_API_KEYonly in environment variables or a.envfile outside Git. - Enforce
drafts onlymode (a human clicks 'Send') and a 25-word cap on voice replies. - Add a
proof checkto every routine so green status requires a non-empty output file.
The fastest way to test barge-in speed and short reply pacing is inside the Google AI Studio Live playground before writing code, then wire up your local folder and first background task.


