Expand description
Testing utilities — a mock model, agent harnesses, contract validation.
Test an agent without a provider by building it on MockLlm and asserting
on both what it returned and what it sent:
use gemini_adk_fluent_rs::prelude::*;
use gemini_adk_fluent_rs::testing::{LlmResponse, MockLlm};
let llm = MockLlm::script([LlmResponse::from_text("Paris.")]);
let agent = AgentBuilder::new("geo")
.instruction("Answer with a city.")
.build(llm.clone())
.unwrap();
let state = State::new();
state.set("input", "Capital of France?").unwrap();
assert_eq!(agent.run(&state).await.unwrap(), "Paris.");
let sent = llm.last_request().unwrap();
assert_eq!(sent.system_instruction.as_deref(), Some("Answer with a city."));Structs§
- Agent
Harness - A test harness for running agents with controlled inputs.
- Data
Flow Edge - A data flow edge between two agents.
- File
Tape - A tape kept in a JSONL file, one
TapeEntryper line. - LlmRequest
- Configuration for an LLM generation request.
- LlmResponse
- The response from an LLM generation request.
- Manual
Clock - A clock that moves only when told to.
- Memory
Tape - A tape held in memory.
- MockLlm
- A
BaseLlmthat replies from a script or a closure and records every request, for tests that must not reach a provider. - Scripted
Run - The outcome of
ScriptedServer::play. - Scripted
Server - A scripted Gemini Live server, for testing a
Livesession offline. - System
Clock - The real clock:
Instant::nowandSystemTime::now. - Tape
Entry - One recorded call: what went in and what came out.
- Taped
Llm - A
BaseLlmthat records its calls to aTapeor answers them from one. See the module docs. - Token
Usage - Token usage statistics.
Enums§
- Contract
Violation - Contract violation detected during static analysis.
- Live
Violation - A misconfiguration found in a
Livebuilder, before connecting. - Tape
Mode - Whether a
taped_resolverrecords calls or answers them from the tape.
Traits§
Functions§
- check_
contracts - Check state contracts across a set of agents.
- check_
live - Statically check a configured
Livesession. - diagnose
- Diagnostic utility — returns a summary of an agent builder’s configuration.
- infer_
data_ flow - Infer data flow between agents based on reads/writes declarations.
- taped_
resolver - Wrap a resolver’s
fetchso its calls are recorded on, or answered from,tape.
Type Aliases§
- Shared
Clock - A shared, dynamically dispatched clock.