Module prelude

Module prelude 

Source
Expand description

The kernel prelude — the ~40 types a typical application touches.

Gap #9 carved this down from the previous everything-prelude. Anything not here now lives in a focused submodule and is one import away:

NeedImport
Full Live control plane (persistence, repair, steering, transcripts, contracts)use gemini_adk_fluent_rs::live::*;
Text-agent runtime detailsuse gemini_adk_fluent_rs::text::*;
Toolsets, confirmation, framesuse gemini_adk_fluent_rs::tools::*;
State prefixes / SlotEvidenceuse gemini_adk_fluent_rs::state::*;
Full flow vocabulary (CompiledFlow, StepAction, Violation, …)use gemini_adk_fluent_rs::flow::*;
Agent trait + operator/pattern internalsuse gemini_adk_fluent_rs::agents::*;
Conversation compiler (Conversation, ConversationSpec, …)use gemini_adk_fluent_rs::conversation::*;
A2A, motifs, policy, simulation, testing, orchestration, credentials, run_configthe same-named module, e.g. use gemini_adk_fluent_rs::simulation::*;
Raw L0 wire typesuse gemini_adk_fluent_rs::wire::*;

Re-exports§

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::testing::check_contracts;
pub use crate::testing::diagnose;
pub use crate::testing::infer_data_flow;
pub use crate::testing::AgentHarness;
pub use crate::testing::ContractViolation;
pub use crate::testing::DataFlowEdge;
pub use crate::builder::*;
pub use crate::operators::*;
pub use crate::patterns::*;

Modules§

client
Client → Server message types for the Gemini Live wire protocol.
server
Server → Client message types for the Gemini Live wire protocol.
tool
Tool dispatch — regular, streaming, and input-streaming tools.

Structs§

ActivityEnd
Marker for speech activity end.
ActivitySignalMessage
Activity signal for client-side VAD events.
ActivitySignalPayload
Payload for activity signals.
ActivityStart
Marker for speech activity start.
AudioJitterBuffer
Adaptive jitter buffer for audio playback.
AutomaticActivityDetection
Automatic activity detection (VAD) settings.
BargeInConfig
Configuration for barge-in behavior.
BargeInDetector
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.
CallbackContext
Rich context for callbacks — provides access to state, artifacts, memory, and event actions for mutation.
Candidate
A single response candidate.
CitationMetadata
Citation metadata for a response.
CitationSource
A single citation source.
Client
Unified Gemini API client.
ClientContentMessage
Client content message for sending text or conversation history.
ClientContentPayload
Payload for client content.
CodeExecutionResult
Result of code execution.
ConnectBuilder
Builder for advanced connection configuration.
Content
A content message containing a role and a sequence of parts.
ContextWindowCompressionConfig
Context window compression configuration for long sessions.
DispatchTextAgent
Fire-and-forget background task launcher with global task budget.
EventCallbacks
Typed callback registry for Live session events.
ExecutableCode
Executable code returned by the model.
Extract
A declarative extraction record: typed fields filled by recognizers and/or async resolvers.
FallbackTextAgent
Tries each child agent in sequence. Returns the first successful result. If all fail, returns the last error.
FileData
Reference to an uploaded file.
FileWireRecorder
Durable WireRecorder writing one JSON object per line (JSONL).
Flow
A governed conversation/tool DAG.
FlowMonitor
Observes the session trace, maintains the Marking, answers tool admissibility, and projects active postures.
FnTextAgent
Zero-cost state transform agent — executes a closure, no LLM call.
FsPersistence
File-system persistence (good for development and single-server deployments).
FunctionCall
A function call request from the model.
FunctionCallingConfig
Configuration for function calling behavior.
FunctionDeclaration
Schema for a single function that the model can call.
FunctionResponse
A function call response sent back to the model.
GeminiLlm
Concrete Gemini LLM implementation using gemini-live Client.
GenerateContentConfig
Configuration for a generateContent request.
GenerateContentResponse
Top-level response from generateContent.
GenerationConfig
Generation config sent in the setup message.
GoAwayMessage
Server GoAway signal — requesting graceful disconnect.
GoAwayPayload
Payload for GoAway.
GoogleAIAuth
Google AI API key authentication.
GoogleAITokenAuth
Google AI OAuth2 access token authentication.
GoogleSearch
Google Search tool configuration (empty — presence enables the feature).
GoogleSearchRetrieval
Google Search retrieval tool configuration.
GroundingMetadata
Grounding metadata for server content with search results.
HttpClient
HTTP client wrapping reqwest with retry and telemetry.
HttpConfig
Configuration for the HTTP client.
InputAudioTranscription
Input audio transcription configuration.
JitterConfig
Configuration for the jitter buffer.
JoinTextAgent
Waits for dispatched background tasks and collects their results.
JsonCodec
Default JSON codec — current behavior extracted from connection.rs.
LiveHandle
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.
LlmTextAgent
Core text agent — calls BaseLlm::generate(), dispatches tools, loops until the model produces a final text response.
LoopTextAgent
Runs a text agent repeatedly until max iterations or a state predicate.
MapOverTextAgent
Iterates a single agent over each item in a state list. Reads state[list_key], runs agent per item (setting state[item_key]), collects results into state[output_key].
MediaChunk
A single chunk of media data (audio). Deprecated — use Blob in audio field.
MemoryPersistence
In-memory persistence (good for tests).
MemoryWireRecorder
In-memory WireRecorder for tests and replay harnesses.
MockTransport
Mock transport for unit testing.
ModalityTokenCount
Token count breakdown by modality (text, audio, image, video).
OutputAudioTranscription
Output audio transcription configuration.
ParallelTextAgent
Runs text agents concurrently. All branches share state. Results are collected and joined with newlines.
PrebuiltVoiceConfig
Prebuilt voice selection.
ProactivityConfig
Proactivity configuration — controls whether the model can initiate responses.
RaceTextAgent
Runs agents concurrently, returns the first to complete. Cancels the rest.
RealtimeInputConfig
Server-side VAD configuration for the setup message.
RealtimeInputMessage
Realtime audio input sent as a stream of chunks.
RealtimeInputPayload
Payload for realtime audio input.
RecordingCodec
A Codec decorator that records every byte crossing the wire.
RepairConfig
Configuration for the conversation repair system.
ReplayControl
Control handle for a ReplayTransport that has been moved into a session loop.
ReplayTransport
A Transport that replays recorded inbound frames and collects outbound frames. See the module docs for gating and drain semantics.
ResumeInfo
Session resumption information from the server.
RouteRule
A routing rule: predicate over state → target agent.
RouteTextAgent
State-driven deterministic branching — evaluates predicates in order, dispatches to the first matching agent. Falls back to default if none match.
SafetyRating
Per-category safety assessment of generated content.
SafetySetting
Per-category safety configuration for content generation.
SequentialTextAgent
Runs text agents sequentially. Each agent sees state mutations from previous agents. The final agent’s output is the pipeline’s output.
ServerContentMessage
Server content message containing model output.
ServerContentPayload
Payload for server content.
ServerMessageWrapper
Server message wrapper — includes optional usage metadata alongside the message.
SessionConfig
Complete session configuration — the builder entrypoint.
SessionHandle
The public API surface for a Gemini Live session.
SessionResumptionConfig
Session resumption configuration.
SessionResumptionResult
Session resumption result from server.
SessionResumptionUpdateMessage
Session resumption update from server (sent during active session).
SessionResumptionUpdatePayload
Payload for session resumption update.
SetupCompleteMessage
Server setup complete acknowledgment.
SetupCompletePayload
Payload for setup complete.
SetupMessage
Top-level setup message sent immediately after WebSocket connect.
SetupPayload
Payload of the setup message.
SimpleTool
Simple function tool that wraps an async closure.
SlidingWindow
Sliding window configuration for context compression.
SoftTurnDetector
Detects proactive silence — user stopped speaking but model didn’t respond.
SpeechConfig
Speech configuration for audio output.
SpscRing
Lock-free single-producer single-consumer ring buffer.
State
A concurrent, type-safe state container that agents read from and write to.
StateKey
A compile-time typed state key that eliminates typo bugs and type mismatches.
TapTextAgent
Read-only observation agent. Calls a function with the state but cannot mutate it. Returns empty string. No LLM call.
TaskRegistry
Shared registry for dispatched background tasks.
TelemetryConfig
Telemetry configuration.
ThinkingConfig
Configuration for model thinking/reasoning (Gemini 2.5+).
TimeoutTextAgent
Wraps an agent with a time limit. Returns AgentError::Timeout if exceeded.
Tool
A tool declaration sent in the setup message. Each Tool object can contain one of: function declarations, urlContext, googleSearch, codeExecution, or googleSearchRetrieval.
ToolCallCancellationMessage
Server tool call cancellation message.
ToolCallCancellationPayload
Payload for tool call cancellation.
ToolCallMessage
Server tool call request message.
ToolCallPayload
Payload for tool call.
ToolCodeExecution
Code execution tool configuration (empty — presence enables the feature).
ToolConfig
Controls how and when the model uses tools.
ToolContext
Extended context for tool execution — adds function call ID and confirmation.
ToolDispatcher
Routes function calls to the right tool implementation.
ToolPolicy
The precomputed tool-gating surface of a compiled flow: every tool name the flow reasons about, so introspection can enumerate and explain decisions.
ToolResponseMessage
Tool response message sent after executing function calls.
ToolResponsePayload
Payload for tool response.
TranscriptBuffer
Accumulates input/output transcripts and segments them by turn boundaries.
TranscriptTurn
A single completed conversation turn with accumulated transcripts.
TranscriptionPayload
Transcription text from server.
TransportConfig
Configuration for the transport layer.
TungsteniteTransport
WebSocket transport using tokio-tungstenite.
TurnDetectionConfig
Configuration for client-side turn detection.
TurnDetector
Client-side turn detector.
TypedTool
Type-safe function tool with auto-generated JSON Schema.
UrlContext
URL context tool configuration (empty — presence enables the feature).
UrlContextMetadata
URL context metadata for content sourced from URLs.
UsageMetadata
Usage metadata returned by the server on messages.
VadConfig
VAD configuration parameters.
VertexAIAuth
Vertex AI Bearer token authentication.
VertexConfig
Configuration for connecting through Vertex AI.
VoiceActivityDetector
Voice Activity Detector with adaptive noise floor.
VoiceActivityMessage
Server-side voice activity detection event.
VoiceActivityPayload
Payload for voice activity detection.
VoiceConfig
Voice configuration within speech config.
WireEntry
One recorded wire frame: sequence, direction, timestamp, raw payload.
WireRecorderHandle
Cloneable, Debug-friendly handle to a shared WireRecorder.

Enums§

ActivityHandling
Controls how incoming audio interacts with model output.
AgentError
Errors that can occur during agent execution.
ApiEndpoint
API endpoint selector — Google AI (direct), Google AI with OAuth token, or Vertex AI.
AudioFormat
Audio encoding formats supported by the Gemini Live API.
AuthError
Authentication-specific errors.
BargeInAction
Result of a barge-in check.
CodecError
Error during encoding or decoding.
ContextDelivery
When to deliver model-role context turns to the wire.
EndpointEnvError
Error resolving an ApiEndpoint from the environment.
ExtractionTrigger
Controls WHEN an extractor runs.
FinishReason
Why the model stopped generating.
FlowMode
How a FlowMonitor treats off-path activity — enforcement vs observation.
FunctionCallingBehavior
Whether tool calls block model output or run concurrently.
FunctionCallingMode
How the model should decide when to execute tool calls.
FunctionResponseScheduling
Scheduling mode for non-blocking function responses.
GeminiModel
Gemini models that support the Multimodal Live API.
GenerateError
Errors specific to the Generate API.
Guard
A boolean predicate over (state, marking) — the only predicate type.
HarmBlockThreshold
Blocking threshold for safety settings.
HarmCategory
Categories of potential harm in model output.
HarmProbability
Probability that content is harmful.
HttpError
Errors from HTTP client operations.
MediaResolution
Media resolution for image/video inputs.
Modality
Output modalities the model can produce.
Part
A single part of a Content message. Parts are polymorphic — discriminated by field presence, not a type tag.
Platform
Which platform variant to use for the Gemini API.
Role
Role in a conversation.
Sensitivity
Voice activity detection sensitivity level.
ServerMessage
Unified server message enum — parsed from incoming WebSocket text frames.
ServiceEndpoint
Identifies which Gemini API service to connect to.
SessionCommand
Commands sent from application code to the session transport.
SessionError
Errors that can occur during a session.
SessionEvent
Events emitted by the session, consumed by application code.
SessionPhase
The lifecycle phase of a Gemini Live session.
SetupError
Errors during the setup handshake phase.
SteeringMode
How the phase machine steers the model’s behavior.
ToolError
Errors that can occur during tool execution.
TurnCoverage
Controls which input counts toward a user’s conversation turn.
TurnDetectionEvent
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.
VoiceActivityType
Type of voice activity event from the server.
WebSocketError
WebSocket-level errors with structured detail.
WireDirection
Direction of a recorded wire frame, relative to the client.
WireLogError
Error reading a JSONL wire log.

Traits§

AgentTrait
The fundamental agent trait. Everything that can process a live session implements this — LLM agents, function agents, pipelines, routers.
AuthProvider
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)].
SessionPersistence
Trait for persisting session state across process restarts.
SessionReader
Read-side of a session — subscribe to events and observe phase.
SessionWriter
Write-side of a session — send commands without owning the full handle.
TextAgent
A text-based agent that runs via BaseLlm::generate() (request/response).
ToolFunction
A regular tool — called once, returns a result.
ToolProvider
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.
TurnExtractor
Trait for between-turn extraction from transcript windows.
WireRecorder
Synchronous sink for recorded wire frames.

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).
into_shared
Wrap raw bytes as a shared Bytes handle for zero-copy fan-out.
quick_connect
Connect to Gemini Live with minimal configuration.
quick_connect_vertex
Connect via Vertex AI with minimal configuration.
read_wire_log
Read a JSONL wire log written by FileWireRecorder back into entries.
recv_event
Receive the next event from a broadcast receiver, handling lag gracefully.

Type Aliases§

AgentResult
Convenience alias for fallible agent-runtime operations.
ToolDeclaration
Backward-compatible alias for Tool.

Attribute Macros§

tool
Turn an async fn into a registrable Gemini tool.

Derive Macros§

Extract
Derive an Extract record builder from a struct’s fields.
Frame
Derive a Frame impl from a struct’s #[slot(..)] fields.