Expand description
The kernel prelude — the ~40 types a typical application touches.
Deliberately a kernel, not an everything-glob. Anything not here lives in a focused submodule and is one import away:
| Need | Import |
|---|---|
| Full Live control plane (persistence, repair, steering, transcripts, contracts) | use gemini_adk_fluent_rs::live::*; |
| Text-agent runtime details | use gemini_adk_fluent_rs::text::*; |
| Toolsets, confirmation, frames | use gemini_adk_fluent_rs::tools::*; |
State prefixes / SlotEvidence | use gemini_adk_fluent_rs::state::*; |
Full flow vocabulary (CompiledFlow, StepAction, Violation, …) | use gemini_adk_fluent_rs::flow::*; |
Agent trait + operator/pattern internals | use gemini_adk_fluent_rs::agents::*; |
Conversation compiler (Conversation, ConversationSpec, …) | use gemini_adk_fluent_rs::conversation::*; |
| A2A, motifs, policy, simulation, testing, orchestration, credentials, run_config | the same-named module, e.g. use gemini_adk_fluent_rs::simulation::*; |
| Raw L0 wire types | use gemini_adk_fluent_rs::wire::*; |
Re-exports§
pub use crate::voice::Talk;pub use crate::compose::A;pub use crate::compose::C;pub use crate::compose::Ctx;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::testing::AgentHarness;pub use crate::testing::ContractViolation;pub use crate::testing::DataFlowEdge;pub use crate::testing::LiveViolation;pub use crate::testing::check_contracts;pub use crate::testing::check_live;pub use crate::testing::diagnose;pub use crate::testing::infer_data_flow;pub use crate::builder::*;pub use crate::operators::*;pub use crate::patterns::*;
Modules§
- tool
- Tool dispatch — regular, streaming, and input-streaming tools.
- tool_
media - Tool media returns — the ADK pattern where a function response carries images or other media to the model alongside its JSON payload, so vision tools (screenshots, chart renderers, document croppers) feed the model something it can actually look at.
Structs§
- Audio
Jitter Buffer - Adaptive jitter buffer for audio playback.
- 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.
- Batch
Job - A batch prediction job resource.
- Batch
JobDestination - Destination configuration for a batch job.
- Batch
JobSource - Source configuration for a batch job.
- Blob
- A blob of inline data (audio, image, etc.) sent to or received from Gemini.
- Cached
Content - Cached content resource.
- Cached
Content Usage Metadata - Usage metadata for cached content.
- Callback
Context - Rich context for callbacks — provides access to state, artifacts, memory, and event actions for mutation.
- Chat
Session - A stateful chat session that tracks conversation history.
- Citation
Metadata - Citation metadata for a response.
- Citation
Source - A single citation source.
- Code
Execution Result - Result of code execution.
- Config
Error - A build-time configuration error: one or more problems found while
validating user-supplied configuration (a
Flow, aPhaseMachine, aComputedRegistry, …). - Connect
Builder - Connects a
SessionConfigwith options: transport tuning, a custom transport or codec, a wire recorder.connectis the same thing with none of them. - Content
- A content message containing a role and a sequence of parts.
- Content
Embedding - Embedding vector.
- Context
Window Compression Config - Context window compression configuration for long sessions.
- Count
Tokens Response - Response from countTokens.
- Create
Batch JobConfig - Configuration for creating a batch job.
- Create
Cached Content Config - Configuration for creating cached content.
- Create
Tuning JobConfig - Configuration for creating a tuning job.
- Dispatch
Text Agent - Fire-and-forget background task launcher with global task budget.
- Embed
Content Config - Configuration for embed requests.
- Embed
Content Response - Response from embedContent.
- Event
Callbacks - Typed callback registry for Live session events.
- Executable
Code - Executable code returned by the model.
- Extract
- A declarative extraction record: typed fields filled by recognizers and/or async resolvers.
- Fallback
Text Agent - Tries each child agent in sequence. Returns the first successful result. If all fail, returns the last error.
- File
Data - Reference to an uploaded file.
- Flow
- A governed conversation/tool DAG.
- Flow
Monitor - Observes the session trace, maintains the
Marking, answers tool admissibility, and projects active postures. - 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.
- 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.
- 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.
- List
Batch Jobs Response - Response from listBatchJobs.
- List
Cached Contents Response - Response from listCachedContents.
- List
Models Response - Response from list models.
- List
Tuning Jobs Response - Response from listTuningJobs.
- Live
Handle - Handle for interacting with a running Live session.
- LlmExtractor
- LLM-backed turn extractor that sends transcript windows to an OOB LLM with a structured extraction prompt.
- 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]. - 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).
- ModelId
- A Gemini model identifier, exactly as the API accepts it.
- 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.
- 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.
- 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.
- 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.
- 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.
- Simple
Tool - Simple function tool that wraps an async closure.
- 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
Consumer - The reading half of an
SpscRing. - Spsc
Producer - The writing half of an
SpscRing. - Spsc
Ring - Wait-free single-producer single-consumer ring buffer for audio samples.
- 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.
- Supervised
Tuning Spec - Supervised tuning specification.
- 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.
- Template
Instruction - A full template-engine instruction (feature
templates) — minijinja (Jinja2 syntax: conditionals, loops, filters) over the session state, mirroring ADK’suse_jinja2instructions. The whole state is exposed asstate(subscript prefixed keys:{{ state["session:turn_count"] }}), and every key that is a bare identifier is also available at top level ({{ name }}). Falls back to the empty string for missing values under Jinja’s default undefined semantics. - 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
Code Execution - Code execution tool configuration (empty — presence enables the feature).
- Tool
Config - Controls how and when the model uses tools.
- Tool
Context - Extended context for tool execution — adds function call ID and confirmation.
- Tool
Dispatcher - Routes function calls to the right tool implementation.
- Tool
Policy - Optional per-tool execution policy.
- Transcript
Buffer - Accumulates input/output transcripts and segments them by turn boundaries.
- Transcript
Turn - A single completed conversation turn with accumulated transcripts.
- Transport
Config - Configuration for the transport layer.
- Tungstenite
Transport - WebSocket transport using
tokio-tungstenite. - Tuning
Hyper Parameters - Tuning hyperparameters.
- Tuning
Job - A tuning job resource.
- Turn
Detection Config - Configuration for client-side turn detection.
- Turn
Detector - Client-side turn detector.
- Typed
Tool - Type-safe function tool with auto-generated JSON Schema.
- Update
Cached Content Request - Updates to apply to a cached content resource.
- 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
Config - Voice configuration within speech config.
Enums§
- Access
Token - An OAuth2 access token source.
- 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.
- Batch
JobState - State of a batch job.
- Batches
Error - Errors from the Batches API.
- Buffer
State - Current state of the jitter buffer.
- Caches
Error - Errors from the Caches API.
- Codec
Error - Error during encoding or decoding.
- Context
Delivery - When to deliver model-role context turns to the wire.
- Embed
Error - Errors from the Embed API.
- Endpoint
EnvError - Error resolving an
ApiEndpointfrom the environment. - Enforcement
- How a
FlowMonitortreats off-path activity — enforcement vs observation. - 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.
- Generate
Error - Errors specific to the Generate API.
- Guard
- A boolean predicate over
(state, marking)— the only predicate type. - 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.
- Media
Resolution - Media resolution for image/video inputs.
- Modality
- Output modalities the model can produce.
- Models
Error - Errors from the Models API.
- Part
- A single part of a
Contentmessage. Parts are polymorphic — discriminated by field presence, not a type tag. - Persistence
Error - Error returned by a
SessionPersistencebackend. - 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.
- Tokens
Error - Errors from the Tokens API.
- Tool
Error - Errors that can occur during tool execution.
- Tungstenite
Error - Errors from the
TungsteniteTransport. - Tuning
JobState - State of a tuning job.
- Tunings
Error - Errors from the Tunings API.
- 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.
- Verdict
- The conformance status of a step.
- Voice
- Available voice presets for Gemini Live audio output.
- WebSocket
Error - WebSocket-level errors with structured detail.
Constants§
- LIVE_
INPUT_ SAMPLE_ RATE - The sample rate the Live API takes on the way in.
Traits§
- Agent
- The fundamental agent trait. Everything that can process a live session implements this — LLM agents, function agents, pipelines, routers.
- 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.
- Frame
- A typed conversation frame. Implement via
#[derive(Frame)]. - Instruction
Provider - A dynamic instruction source — the ADK “instruction provider” pattern:
instead of a string fixed at build time, the instruction is produced
from live session state on every model request (persona switching,
risk-driven guardrails, multi-tenant instructions without rebuilding
the agent). Any
Fn(&State) -> Stringclosure is a provider. - 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
Function - A regular tool — called once, returns a result.
- Tool
Provider - Declares tools for a Gemini session setup message. Implement this trait to provide tools from any source (runtime ToolDispatcher, etc.).
- 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 with the default transport and return a session handle.
- i16_
to_ bytes - Convert a slice of i16 PCM samples to raw bytes (zero-copy via bytemuck).
- into_
shared - Wrap raw bytes as a shared
Byteshandle for zero-copy fan-out. - recv_
event - Receive the next event from a broadcast receiver, handling lag gracefully.
Type Aliases§
- Agent
Result - Convenience alias for fallible agent-runtime operations.
Attribute Macros§
- tool
- Turn an
async fninto a registrable Gemini tool.