Expand description
Offline session replay — feed a recorded wire log through the real control plane.
Recording happens at L0 via
SessionConfig::record_wire
(every wire byte, both directions, as [WireEntry] JSONL). This module
closes the loop: replay_session opens a
[ReplayTransport] over the log’s inbound frames and attaches the same three-lane processor a
live connection would get — phase machine, extractors, watchers, tool
dispatch, flow governance all run for real. Nothing is mocked above the
transport seam.
What replay does and does not do:
- Does: re-decode every recorded inbound frame, re-drive the L1 processor (events, state writes, tool dispatch through whatever dispatcher you attach), and collect the outbound frames the processor regenerates (setup, tool responses) for comparison against the log.
- Does not: re-execute the model. The model’s outputs are in the recorded inbound frames. User-originated sends (text/audio) are in the log’s outbound entries but are not re-sent — they only ever existed to provoke the recorded inbound frames.
use gemini_adk_rs::live::replay::replay_session;
use gemini_adk_rs::live::LiveSessionBuilder;
use gemini_genai_rs::prelude::{read_wire_log, SessionConfig};
let entries = read_wire_log("session.wire.jsonl")?;
let config = SessionConfig::new("offline");
let builder = LiveSessionBuilder::new(config.clone());
let replay = replay_session(config, builder, &entries).await?;
let mut events = replay.handle().events();
replay.release(); // start streaming recorded frames
replay.drained().await; // all frames handed to the session loopStructs§
- Replay
Session - A replayed session: the live handle plus the replay controls.
Functions§
- attach_
session - Attach the full L1 control plane (three-lane processor, phase machine, extractors, watchers, tool dispatch, …) to an already connected L0 session.
- collect_
events_ until_ idle - Collect
LiveEvents until the stream stays idle foridle(ormaxelapses). Useful for settling an as-fast-as-possible replay where “done” means “no more effects are propagating”. - replay_
session - Replay a recorded wire log through the real L1 processor, offline.