Expand description
Live — Fluent builder for callback-driven Gemini Live sessions.
Wraps L1’s LiveSessionBuilder with ergonomic callback registration
and integration with composition modules (M, T, P).
§Callback Modes
Control-lane callbacks support two execution modes via gemini_adk_rs::live::ExecutionMode:
- Default methods (e.g.,
.on_turn_complete()) →gemini_adk_rs::live::ExecutionMode::Blocking _concurrentmethods (e.g.,.on_turn_complete_concurrent()) →gemini_adk_rs::live::ExecutionMode::Concurrent
Use concurrent mode for fire-and-forget work (logging, analytics, webhook
dispatch). The lane rule for every callback is written once, at the top of
the callbacks module (see the Live callback setters).
§Background Tool Execution
Mark tools for background execution to eliminate dead air in voice sessions:
Live::builder()
.tools(tools)
.tool_background("search_kb")
.connect_from_env()
.await?;Structs§
- Backend
Input Vad - Incremental VAD over arbitrary PCM16 byte chunks.
- Backend
VadSnapshot - Snapshot of backend VAD state for devtools and diagnostics.
- Background
Agent Dispatcher - Dispatcher for running
TextAgentpipelines as background tasks. - Background
Tool Tracker - Tracks in-flight background tool executions for cancellation.
- Computed
Contract - A computed state declaration.
- Computed
Registry - Registry of computed variables with dependency-ordered evaluation.
- Computed
Var - A computed state variable: a pure function of other state keys.
- Consecutive
Failure Detector - Fires when a named tool has failed
thresholdconsecutive times. - Context
Builder - Declarative state-to-narrative renderer.
- Control
Contract - Runtime control-plane settings.
- Default
Result Formatter - Default formatter that wraps results in a status object.
- Deferred
Writer - A
SessionWriterwrapper that flushes pending context before user content. - Delivery
Config - Per-event-class delivery (backpressure) policy for the fast lane.
- Effect
Policy - Execution policy for an effect.
- Event
Callbacks - Typed callback registry for Live session events.
- Extractor
Contract - A turn extractor declaration.
- Field
Promotion - Rule for promoting one raw extraction field into authoritative state.
- FsPersistence
- File-system persistence (good for development and single-server deployments).
- Input
Audio Config - Input-audio hardening configuration accumulated by the builder and
applied to the
LiveHandleright after connect. Stages run over each outgoing frame in the order they were configured — chain the denoiser before the gate so the gate calibrates on clean levels (seeLive::mic_denoise,Live::mic_noise_gate,Live::mic_processor,Live::input_vad,Live::client_interruption_authority). - Latency
Bucket - One bucket of the response-latency histogram.
- Latency
Stats - Response-latency distribution for the session so far.
- Live
- Fluent builder for constructing and connecting Gemini Live sessions.
- Live
Effect Executor - Executes
LiveEffectvalues emitted by the Live reactor. - Live
Event Stream - A [
futures_util::Stream] ofLiveEvents from a Live session. - Live
Handle - Handle for interacting with a running Live session.
- Live
Reactor - Ordered collection of reactor rules.
- Live
Session Builder - Builder for a callback-driven Live session.
- LlmExtractor
- LLM-backed turn extractor that sends transcript windows to an OOB LLM with a structured extraction prompt.
- Memory
Persistence - In-memory persistence (good for tests).
- Needs
Fulfillment - Tracks need fulfillment per phase and recommends repair actions.
- Pending
Context - Thread-safe buffer for pending context turns awaiting delivery.
- Phase
- A conversation phase with instruction, tools, and transitions.
- Phase
Contract - A conversation phase declaration.
- Phase
Machine - Evaluates transitions and manages phase entry/exit lifecycle.
- Phase
Preparation - A preparation effect that can materialize state before a phase is entered.
- Preparation
Contract - A phase preparation declaration.
- Promotion
Contract - A field promotion declaration.
- Rate
Detector - Fires when at least
countmatching events occur withinwindow. - Reaction
- A policy-wrapped effect.
- Repair
Config - Configuration for the conversation repair system.
- Replay
Session - A replayed session: the live handle plus the replay controls.
- Runtime
Contract - Serializable description of a configured Live runtime.
- Session
Signals - Tracks session-level signals automatically from events.
- Session
Snapshot - Serializable snapshot of the control plane state.
- Session
Telemetry - Zero-overhead telemetry collector for speech-to-speech sessions.
- Soft
Turn Detector - Detects proactive silence — user stopped speaking but model didn’t respond.
- Sustained
Detector - Fires when a state-based condition remains true for at least
duration. - Temporal
Registry - Registry of temporal patterns evaluated on events and/or timer ticks.
- Tool
Call Summary - Summary of a tool call within a conversation turn.
- Tool
Contract - A tool declaration in the runtime contract.
- Transcript
Buffer - Accumulates input/output transcripts and segments them by turn boundaries.
- Transcript
Turn - A single completed conversation turn with accumulated transcripts.
- Transcript
Window - A read-only snapshot of recent transcript turns for context construction.
- Transition
- A guard-based transition to a named target phase.
- Transition
Contract - A phase transition declaration.
- Transition
Record - Record of a single phase transition that already happened, kept in
PhaseMachine::history. Distinct fromTransition, the declared edge. - Transition
Result - Result of a phase transition, carrying the resolved instruction and any context to inject.
- Turn
Commit Config - Operating point for turn commitment. All timings are measured from the VAD edge (which already includes the detector’s hangover).
- Turn
Commit Policy - The policy state machine. Driven by a monotonic millisecond audio clock (advance it by the duration of each audio chunk, not wall time).
- Turn
Count Detector - Fires when a state-based condition is true for
requiredconsecutive evaluations (typically one evaluation per turn). - Voice
Runtime State - Voice-flow state owned by the reactor.
- Watcher
- A single state watcher: observes one key, fires an async action when the predicate matches.
- Watcher
Contract - A watcher declaration.
- Watcher
Registry - Registry of state watchers, evaluated after each mutation cycle.
Enums§
- Activity
Authority - Who decides when user speech interrupts the model.
- Context
Delivery - When to deliver model-role context turns to the wire.
- Delivery
- Backpressure (delivery) policy for a single class of fast-lane events.
- Execution
Mode - How an async hook or effect runs relative to the control lane.
- Extraction
Trigger - Controls WHEN an extractor runs.
- Input
Stage - One stage of the input mic chain — the named stages the SDK ships plus
an open
Customslot for anyInputAudioProcessor. - Instruction
Modifier - A modifier that transforms a phase instruction based on runtime state.
- Live
Effect - A typed runtime effect emitted by a reaction.
- Live
Event - Semantic events emitted by the Live session processor.
- Merge
Policy - How an extracted field should be merged into authoritative session state.
- Persistence
Error - Error returned by a
SessionPersistencebackend. - Phase
Instruction - Instruction source for a phase — either a fixed string or a closure over state.
- Reactor
Event - A normalized event that can drive ADK-level reactions.
- Repair
Action - What action the repair system recommends.
- Session
Type - Session type determines the server-side duration limit.
- Steering
Mode - How the phase machine steers the model’s behavior.
- Tool
Execution Mode - Execution mode for a tool.
- Transition
Evaluation - Result of evaluating outbound transitions.
- Transition
Trigger - What caused a phase transition.
- Turn
Signal - A committed turn signal, produced at its commit time.
- Watch
Predicate - Condition under which a watcher fires, evaluated against (old, new) values.
Constants§
- DEFAULT_
COMPRESSION_ TARGET_ TOKENS - Token count the default sliding window compresses the history down to.
- DEFAULT_
COMPRESSION_ TRIGGER_ TOKENS - Token count at which the default context window compression kicks in.
Traits§
- Input
Audio Processor - A per-frame processor applied to outgoing microphone audio inside
LiveHandle::send_audio— the L1 seam the L2voicechain (denoiser, noise gate) plugs into so hosted surfaces (web bridge, API server) get the same hardened path as native pumps. Runs on the send path: keep it fast and allocation-light. - Pattern
Detector - A detector that evaluates whether a temporal pattern has been triggered.
- Reactor
Rule - A rule that reacts to normalized events and emits typed effects.
- Result
Formatter - Formats tool responses for background execution lifecycle.
- Session
Persistence - Trait for persisting session state across process restarts.
- Turn
Extractor - Trait for between-turn extraction from transcript windows.
Functions§
- attach_
session - Attach the full L1 control plane (three-lane processor, phase machine, extractors, watchers, tool dispatch, …) to an already connected L0 session.
- collect_
events_ until_ idle - Collect
LiveEvents until the stream stays idle foridle(ormaxelapses). Useful for settling an as-fast-as-possible replay where “done” means “no more effects are propagating”. - replay_
session - Replay a recorded wire log through the real L1 processor, offline.
Type Aliases§
- Predicate
Fn - Custom predicate function type for state change watchers.
- Session
Hook - An async session hook: receives a clone of the shared
Stateand the session writer. The shape of phaseon_enter/on_exit, phase preparations, and temporal-pattern actions.