Crate gemini_adk_fluent_rs

Crate gemini_adk_fluent_rs 

Source
Expand description

§gemini-adk-fluent-rs

Fluent developer experience layer for the Gemini Live agent stack. This is the highest-level crate in the workspace, providing a builder API, operator algebra, and composition modules that sit on top of gemini_adk_rs (agent runtime) and gemini_genai_rs (wire protocol).

§Module Organization

ModulePurpose
builderCopy-on-write immutable AgentBuilder for declarative agent configuration
composeThe eight-namespace operator algebra — S state, C context, T tools, P prompts, M middleware, A artifacts, E evaluation, G guards
liveLive session builder — callback-driven full-duplex event handling
live_buildersPhase and watcher sub-builders for Live
operators`>>
patternsPre-built composition patterns for common use cases
voiceMicrophone/speaker plumbing; talk() needs the voice-io feature
testingContract checks, data-flow inference, mock harnesses

§Quick Start

Text generation is on by default (feature gemini-llm); set GEMINI_API_KEY and ask a question:

use gemini_adk_fluent_rs::prelude::*;
use std::sync::Arc;

let llm = Arc::new(GeminiLlm::new(GeminiLlmParams::default()));
let agent = AgentBuilder::new("assistant")
    .instruction("You are a concise assistant.")
    .build(llm)?;
let state = State::new();
state.set("input", "Say hello in one sentence.")?;
println!("{}", agent.run(&state).await?);

// Voice: microphone in, speakers out, barge-in handled — `.talk()` exists
// only with the `voice-io` feature (Linux: libasound2-dev).
let handle = Live::builder()
    .instruction("You are a helpful concierge.")
    .greeting("Greet the caller.")
    .connect_from_env()
    .await?;

§Relationship to Other Crates

  • gemini-genai-rs (L0): wire protocol, transport, types — re-exported as gemini_genai_rs
  • gemini-adk-rs (L1): agent runtime, tools, sessions — re-exported as gemini_adk_rs
  • gemini-adk-fluent-rs (L2): this crate — the builder API and composition algebra

Re-exports§

pub use gemini_adk_rs;
pub use gemini_genai_rs;

Modules§

a2a
A2A — Agent-to-Agent protocol builders.
agents
Agent builders, the L1 Agent trait, and the operator/pattern combinators.
builder
AgentBuilder — copy-on-write immutable builder for fluent agent construction.
compose
Composition modules – S, C, P, M, T, A, E, G.
conversation
The conversation compiler (Phase 1 MVP).
flow
Governed-conversation flow primitives: Flow, Step, Guard, FlowMonitor.
flow_macros
Typed graph macros — compile-time-checked names for flow authoring.
handoff
Warm handoff — transfer the conversation to a human with its context intact.
live
Live — Fluent builder for callback-driven Gemini Live sessions.
live_builders
Sub-builders for the fluent Live API.
llm
LLM abstraction: params, requests/responses, and the registry.
motifs
Conversational motifs — a standard library of high-confidence flow fragments.
operators
Operator algebra for agent composition.
patterns
Pre-built patterns — common multi-agent workflows.
policy
Policy aspects — reusable, cross-cutting governance attached to a whole conversation rather than scattered across stages.
prelude
The kernel prelude — the ~40 types a typical application touches.
primitives
The L2 contract — authoring
simulation
Model-free conversation simulation.
spec
SessionSpec — a whole Live session as one serializable JSON document.
state
Concurrent typed state: State, PrefixedState, StateKey, prefix scopes.
telephony
Telephony — answer the phone with a governed session
testing
Testing utilities — mock backends, agent harnesses, contract validation.
text
Text-agent runtime and combinators (carved out of the kernel prelude).
tools
Tool definitions, dispatch, toolsets, the confirmation flow, and frames.
voice
Voice I/O — a talking application in five lines
wire
L0 wire-protocol types for raw WebSocket access.

Macros§

let_clone
Clone multiple bindings for use in move closures, reducing Arc/clone boilerplate.
voice_flow
Generate a module of compile-time-checked flow name constants.