Expand description
Convenience re-exports for common types across all layers.
Re-exports§
pub use crate::a2a::A2AServer;pub use crate::a2a::AgentRegistry;pub use crate::a2a::RemoteAgent;pub use crate::a2a::SkillDeclaration;pub use crate::compose::Ctx;pub use crate::compose::A;pub use crate::compose::C;pub use crate::compose::E;pub use crate::compose::G;pub use crate::compose::M;pub use crate::compose::P;pub use crate::compose::S;pub use crate::compose::T;pub use crate::live::Live;pub use crate::builder::*;pub use crate::live_builders::*;pub use crate::operators::*;pub use crate::patterns::*;pub use crate::testing::*;
Modules§
- client
- Client → Server message types for the Gemini Live wire protocol.
- server
- Server → Client message types for the Gemini Live wire protocol.
Structs§
- Activity
End - Marker for speech activity end.
- Activity
Signal Message - Activity signal for client-side VAD events.
- Activity
Signal Payload - Payload for activity signals.
- Activity
Start - Marker for speech activity start.
- Agent
Session - Intercepting wrapper around a SessionWriter.
- Audio
Jitter Buffer - Adaptive jitter buffer for audio playback.
- Auth
Credential - An authentication credential with optional token, refresh, and metadata.
- Automatic
Activity Detection - Automatic activity detection (VAD) settings.
- Barge
InConfig - Configuration for barge-in behavior.
- Barge
InDetector - Barge-in detector — checks whether user speech should interrupt model output.
- Blob
- A blob of inline data (audio, image, etc.) sent to or received from Gemini.
- Callback
Context - Rich context for callbacks — provides access to state, artifacts, memory, and event actions for mutation.
- Candidate
- A single response candidate.
- Citation
Metadata - Citation metadata for a response.
- Citation
Source - A single citation source.
- Client
- Unified Gemini API client.
- Client
Content Message - Client content message for sending text or conversation history.
- Client
Content Payload - Payload for client content.
- Code
Execution Result - Result of code execution.
- Connect
Builder - Builder for advanced connection configuration.
- Content
- A content message containing a role and a sequence of parts.
- Context
Window Compression Config - Context window compression configuration for long sessions.
- Default
Result Formatter - Default formatter that wraps results in a status object.
- Deferred
Writer - A
SessionWriterwrapper that flushes pending context before user content. - Dispatch
Text Agent - Fire-and-forget background task launcher with global task budget.
- Event
Callbacks - Typed callback registry for Live session events.
- Executable
Code - Executable code returned by the model.
- Fallback
Text Agent - Tries each child agent in sequence. Returns the first successful result. If all fail, returns the last error.
- Field
Promotion - Rule for promoting one raw extraction field into authoritative state.
- File
Data - Reference to an uploaded file.
- FnText
Agent - Zero-cost state transform agent — executes a closure, no LLM call.
- FsPersistence
- File-system persistence (good for development and single-server deployments).
- Function
Call - A function call request from the model.
- Function
Calling Config - Configuration for function calling behavior.
- Function
Declaration - Schema for a single function that the model can call.
- Function
Response - A function call response sent back to the model.
- Gemini
Llm - Concrete Gemini LLM implementation using gemini-live
Client. - Gemini
LlmParams - Parameters for constructing a
GeminiLlm. - Generate
Content Config - Configuration for a generateContent request.
- Generate
Content Response - Top-level response from generateContent.
- Generation
Config - Generation config sent in the setup message.
- GoAway
Message - Server GoAway signal — requesting graceful disconnect.
- GoAway
Payload - Payload for GoAway.
- GoogleAI
Auth - Google AI API key authentication.
- GoogleAI
Token Auth - Google AI OAuth2 access token authentication.
- Google
Search - Google Search tool configuration (empty — presence enables the feature).
- Google
Search Retrieval - Google Search retrieval tool configuration.
- Grounding
Metadata - Grounding metadata for server content with search results.
- Http
Client - HTTP client wrapping reqwest with retry and telemetry.
- Http
Config - Configuration for the HTTP client.
- InMemory
Credential Service - In-memory credential service for testing and development.
- InMemory
Runner - Runs TextAgents with full service wiring (session, memory, artifacts, plugins).
- Input
Audio Transcription - Input audio transcription configuration.
- Jitter
Config - Configuration for the jitter buffer.
- Join
Text Agent - Waits for dispatched background tasks and collects their results.
- Json
Codec - Default JSON codec — current behavior extracted from connection.rs.
- Live
Handle - Handle for interacting with a running Live session.
- 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.
- LlmRegistry
- Registry that maps model name patterns to LLM factory functions.
- LlmRequest
- Configuration for an LLM generation request.
- LlmResponse
- The response from an LLM generation request.
- LlmText
Agent - Core text agent — calls
BaseLlm::generate(), dispatches tools, loops until the model produces a final text response. - Loop
Text Agent - Runs a text agent repeatedly until max iterations or a state predicate.
- MapOver
Text Agent - Iterates a single agent over each item in a state list.
Reads
state[list_key], runs agent per item (settingstate[item_key]), collects results intostate[output_key]. - Media
Chunk - A single chunk of media data (audio). Deprecated — use Blob in
audiofield. - Memory
Persistence - In-memory persistence (good for tests).
- Mock
Transport - Mock transport for unit testing.
- Modality
Token Count - Token count breakdown by modality (text, audio, image, video).
- Needs
Fulfillment - Tracks need fulfillment per phase and recommends repair actions.
- NoOp
Session Writer - A SessionWriter that discards all writes. Used for isolated agent execution (AgentTool) where no real WebSocket exists.
- Output
Audio Transcription - Output audio transcription configuration.
- Parallel
Text Agent - Runs text agents concurrently. All branches share state. Results are collected and joined with newlines.
- Pending
Context - Thread-safe buffer for pending context turns awaiting delivery.
- Prebuilt
Voice Config - Prebuilt voice selection.
- Proactivity
Config - Proactivity configuration — controls whether the model can initiate responses.
- Race
Text Agent - Runs agents concurrently, returns the first to complete. Cancels the rest.
- Realtime
Input Config - Server-side VAD configuration for the setup message.
- Realtime
Input Message - Realtime audio input sent as a stream of chunks.
- Realtime
Input Payload - Payload for realtime audio input.
- Repair
Config - Configuration for the conversation repair system.
- Resume
Info - Session resumption information from the server.
- Route
Rule - A routing rule: predicate over state → target agent.
- Route
Text Agent - State-driven deterministic branching — evaluates predicates in order, dispatches to the first matching agent. Falls back to default if none match.
- RunConfig
- Configuration for an agent execution run.
- Safety
Rating - Per-category safety assessment of generated content.
- Safety
Setting - Per-category safety configuration for content generation.
- Sequential
Text Agent - Runs text agents sequentially. Each agent sees state mutations from previous agents. The final agent’s output is the pipeline’s output.
- Server
Content Message - Server content message containing model output.
- Server
Content Payload - Payload for server content.
- Server
Message Wrapper - Server message wrapper — includes optional usage metadata alongside the message.
- Session
Config - Complete session configuration — the builder entrypoint.
- Session
Handle - The public API surface for a Gemini Live session.
- Session
Resumption Config - Session resumption configuration.
- Session
Resumption Result - Session resumption result from server.
- Session
Resumption Update Message - Session resumption update from server (sent during active session).
- Session
Resumption Update Payload - Payload for session resumption update.
- Session
Snapshot - Serializable snapshot of the control plane state.
- Setup
Complete Message - Server setup complete acknowledgment.
- Setup
Complete Payload - Payload for setup complete.
- Setup
Message - Top-level setup message sent immediately after WebSocket connect.
- Setup
Payload - Payload of the setup message.
- Sliding
Window - Sliding window configuration for context compression.
- Soft
Turn Detector - Detects proactive silence — user stopped speaking but model didn’t respond.
- Speech
Config - Speech configuration for audio output.
- Spsc
Ring - Lock-free single-producer single-consumer ring buffer.
- State
- A concurrent, type-safe state container that agents read from and write to.
- State
Key - A compile-time typed state key that eliminates typo bugs and type mismatches.
- Static
Toolset - A simple toolset backed by a fixed list of tools.
- TapText
Agent - Read-only observation agent. Calls a function with the state but cannot mutate it. Returns empty string. No LLM call.
- Task
Registry - Shared registry for dispatched background tasks.
- Telemetry
Config - Telemetry configuration.
- Thinking
Config - Configuration for model thinking/reasoning (Gemini 2.5+).
- Timeout
Text Agent - Wraps an agent with a time limit. Returns
AgentError::Timeoutif exceeded. - Tool
- A tool declaration sent in the setup message. Each Tool object can contain one of: function declarations, urlContext, googleSearch, codeExecution, or googleSearchRetrieval.
- Tool
Call Cancellation Message - Server tool call cancellation message.
- Tool
Call Cancellation Payload - Payload for tool call cancellation.
- Tool
Call Message - Server tool call request message.
- Tool
Call Payload - Payload for tool call.
- Tool
Code Execution - Code execution tool configuration (empty — presence enables the feature).
- Tool
Config - Controls how and when the model uses tools.
- Tool
Confirmation - Represents a user’s confirmation decision for a tool call.
- Tool
Context - Extended context for tool execution — adds function call ID and confirmation.
- Tool
Response Message - Tool response message sent after executing function calls.
- Tool
Response Payload - Payload for tool response.
- Transcript
Buffer - Accumulates input/output transcripts and segments them by turn boundaries.
- Transcript
Turn - A single completed conversation turn with accumulated transcripts.
- Transcription
Payload - Transcription text from server.
- Transport
Config - Configuration for the transport layer.
- Tungstenite
Transport - WebSocket transport using
tokio-tungstenite. - Turn
Detection Config - Configuration for client-side turn detection.
- Turn
Detector - Client-side turn detector.
- UrlContext
- URL context tool configuration (empty — presence enables the feature).
- UrlContext
Metadata - URL context metadata for content sourced from URLs.
- Usage
Metadata - Usage metadata returned by the server on messages.
- VadConfig
- VAD configuration parameters.
- VertexAI
Auth - Vertex AI Bearer token authentication.
- Vertex
Config - Configuration for connecting through Vertex AI.
- Voice
Activity Detector - Voice Activity Detector with adaptive noise floor.
- Voice
Activity Message - Server-side voice activity detection event.
- Voice
Activity Payload - Payload for voice activity detection.
- Voice
Config - Voice configuration within speech config.
Enums§
- Activity
Handling - Controls how incoming audio interacts with model output.
- Agent
Error - Errors that can occur during agent execution.
- ApiEndpoint
- API endpoint selector — Google AI (direct), Google AI with OAuth token, or Vertex AI.
- Audio
Format - Audio encoding formats supported by the Gemini Live API.
- Auth
Error - Authentication-specific errors.
- Barge
InAction - Result of a barge-in check.
- Callback
Mode - Controls how a control-lane callback is executed relative to the event loop.
- Codec
Error - Error during encoding or decoding.
- Context
Delivery - When to deliver model-role context turns to the wire.
- Extraction
Trigger - Controls WHEN an extractor runs.
- Finish
Reason - Why the model stopped generating.
- Function
Calling Behavior - Whether tool calls block model output or run concurrently.
- Function
Calling Mode - How the model should decide when to execute tool calls.
- Function
Response Scheduling - Scheduling mode for non-blocking function responses.
- Gemini
Model - Gemini models that support the Multimodal Live API.
- Generate
Error - Errors specific to the Generate API.
- Harm
Block Threshold - Blocking threshold for safety settings.
- Harm
Category - Categories of potential harm in model output.
- Harm
Probability - Probability that content is harmful.
- Http
Error - Errors from HTTP client operations.
- Input
Event - Input events broadcast to input-streaming tools. Distinct from SessionCommand — this is observation-only.
- Live
Event - Semantic events emitted by the Live session processor.
- Media
Resolution - Media resolution for image/video inputs.
- Merge
Policy - How an extracted field should be merged into authoritative session state.
- Modality
- Output modalities the model can produce.
- Part
- A single part of a
Contentmessage. Parts are polymorphic — discriminated by field presence, not a type tag. - Platform
- Which platform variant to use for the Gemini API.
- Repair
Action - What action the repair system recommends.
- Role
- Role in a conversation.
- Sensitivity
- Voice activity detection sensitivity level.
- Server
Message - Unified server message enum — parsed from incoming WebSocket text frames.
- Service
Endpoint - Identifies which Gemini API service to connect to.
- Session
Command - Commands sent from application code to the session transport.
- Session
Error - Errors that can occur during a session.
- Session
Event - Events emitted by the session, consumed by application code.
- Session
Phase - The lifecycle phase of a Gemini Live session.
- Setup
Error - Errors during the setup handshake phase.
- Steering
Mode - How the phase machine steers the model’s behavior.
- Streaming
Mode - How the agent communicates with clients.
- Tool
Error - Errors that can occur during tool execution.
- Tool
Execution Mode - Execution mode for a tool.
- Turn
Coverage - Controls which input counts toward a user’s conversation turn.
- Turn
Detection Event - Events from the turn detector.
- VadEvent
- Events emitted by the VAD.
- Voice
- Available voice presets for Gemini Live audio output.
- Voice
Activity Type - Type of voice activity event from the server.
- WebSocket
Error - WebSocket-level errors with structured detail.
Traits§
- Auth
Provider - Provides authentication credentials and URL construction for Gemini API connections.
- BaseLlm
- Trait for LLM providers — decouples agents from specific models.
- Codec
- Encodes client commands into wire bytes and decodes server bytes into messages.
- Credential
Service - Trait for credential persistence — load, save, delete.
- Result
Formatter - Formats tool responses for background execution lifecycle.
- Session
Persistence - Trait for persisting session state across process restarts.
- Session
Reader - Read-side of a session — subscribe to events and observe phase.
- Session
Writer - Write-side of a session — send commands without owning the full handle.
- Text
Agent - A text-based agent that runs via
BaseLlm::generate()(request/response). - Tool
Provider - Declares tools for a Gemini session setup message. Implement this trait to provide tools from any source (runtime ToolDispatcher, etc.).
- Toolset
- A collection of tools that can be enumerated.
- Transport
- A bidirectional message transport.
- Turn
Extractor - Trait for between-turn extraction from transcript windows.
Functions§
- bytes_
to_ i16 - Convert raw bytes to i16 PCM samples (zero-copy via bytemuck).
- connect
- Connect to the Gemini Multimodal Live API and return a session handle.
- connect_
with - Connect with a custom transport and codec.
- i16_
to_ bytes - Convert a slice of i16 PCM samples to raw bytes (zero-copy via bytemuck).
- inject_
session_ state - Replace
{key}placeholders intemplatewith values fromstate. - into_
shared - Wrap raw bytes as a shared
Byteshandle for zero-copy fan-out. - quick_
connect - Connect to Gemini Live with minimal configuration.
- quick_
connect_ vertex - Connect via Vertex AI with minimal configuration.
- recv_
event - Receive the next event from a broadcast receiver, handling lag gracefully.
Type Aliases§
- Tool
Declaration - Backward-compatible alias for
Tool.