in-process

command
v0.48.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 28, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Example: fully in-process Voice Agent — no SpeechKit server in the path.

This is the in-process counterpart to examples/voice-agent/game-instructor (which drives a running speechkit-server over WebSocket). Here the realtime provider runs inside this binary: we construct a live.LiveProvider directly (Gemini Live), wrap it in a live.Session, and drive a text dialogue. The provider connects straight to the model's realtime API — STT, the LLM turn, and TTS all happen provider-side, so a host needs no separate STT/TTS wiring.

This is the reference an independent coding agent can adapt with one prompt: "Embed a SpeechKit Voice Agent in my Go app." Swap the stdin loop for a mic source and feed session.SendAudio(pcm) to go fully voice; the OnAudio callback already receives the model's 24 kHz PCM for playback.

Run:

GOOGLE_AI_API_KEY=... go run ./examples/voice-agent/in-process

Then type a line and press Enter. Empty input or EOF (Ctrl-D / Ctrl-Z) ends the session. Audio frames from the model are counted, not played, so the example stays portable (no audio device needed).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL