Skip to content

gemini-rs

The model improvises. The conversation must not. Declare a voice conversation as a contract — steps, completion guards, tool gates, ordering — and the runtime enforces it while the model speaks. Full-duplex Gemini Live agents in Rust, in three layered crates.

v2.0 · Rust SDK

3layered crates
30cookbook recipes
2,800+tests, no API key
6Studio cookbooks

A live voice model will happily book the table before checking availability — not because the prompt was wrong, but because a prompt is advice, and advice is not enforcement. gemini-rs treats the conversation as a contract: you declare the flow — steps, completion guards, tool gates, ordering constraints — and the runtime enforces it while the model speaks. A tool the flow has not admitted does not execute, whatever the model intends.

The same contract is a JSON document that validates, simulates, tests, and code-generates offline, and a canvas you can edit by hand. Drop to gemini-genai-rs for byte-level control of the Multimodal Live protocol, or reach for gemini-adk-fluent-rs and have a governed voice agent talking in five lines — the same State spine underpins every layer, so you never hit a ceiling.

Three-crate layered architecture: L2 fluent DX over L1 runtime over L0 wire protocol

CrateLayerUse it when…
gemini-adk-fluent-rsL2 — Fluent DXYou’re building an application: Live::builder(), AgentBuilder, the S·C·T·P·M·A algebra, SessionSpec, voice I/O, telephony. Start here.
gemini-adk-rsL1 — Agent runtimeYou need the runtime directly: State, phases, tool dispatch, Flow, extraction, watchers, combinators, telemetry.
gemini-genai-rsL0 — Wire protocolYou need raw WebSocket access, custom transports, or the feature-gated REST APIs.

Plus gemini-memory-rs, a contextual memory engine for Live sessions, independent of the stack.

use gemini_adk_fluent_rs::prelude::*;
Live::builder()
.instruction("You are a helpful concierge.")
.greeting("Greet the caller.")
.connect_from_env().await? // Google AI or Vertex — resolved from env
.talk().await?; // microphone in, speakers out, barge-in handled

Or with explicit callbacks:

use gemini_adk_fluent_rs::prelude::*;
let handle = Live::builder()
.voice(Voice::Kore)
.instruction("You are a helpful voice assistant.")
.on_audio(|pcm| { /* play audio */ })
.on_text(|text| print!("{text}"))
.connect_from_env()
.await?;
handle.send_text("What's the weather like?").await?;
handle.disconnect().await?;

New here? Start with Setup and Running and Authentication & Connecting, then browse the cookbook (Crawl → Walk → Run → Governed).

A whole governed session — flow DAG, tools, extraction, phases, watchers, computed state, memory, runtime tuning, and an embedded test suite — can be one JSON document (SessionSpec). It validates, simulates, and code-generates offline, and the Flow Studio is a drag-and-drop editor over exactly that document:

Flow Studio click-through: load a cookbook, drag nodes, validate, run embedded tests, scrub a simulated session, read the generated Rust

See Flows as JSON for the format and the Studio tour for the editor.

Memory

The durable memory engine — async-prepare, sync-consume — and its declarative binding into governed state.