pub struct LoopRecord {Show 19 fields
pub loop_id: String,
pub session_id: String,
pub agent_id: String,
pub parent_loop_id: Option<String>,
pub continuation_kind: ContinuationKind,
pub started_at: DateTime<Utc>,
pub ended_at: Option<DateTime<Utc>>,
pub status: LoopStatus,
pub rejection: Option<String>,
pub config: Option<LoopConfigSnapshot>,
pub messages: Vec<AgentMessage>,
pub turns: Vec<Turn>,
pub usage: Usage,
pub metadata: Option<Value>,
pub events: Vec<LoopEvent>,
pub children_loop_ids: Vec<String>,
pub child_loop_refs: Vec<ChildLoopRef>,
pub parallel_group: Option<ParallelGroupRecord>,
pub compaction_block: Option<CompactionBlock>,
}Expand description
A complete record of one agent-loop execution.
§Loop origin classification
parent_loop_id | continuation_kind | Meaning |
|---|---|---|
None | Initial | Fresh origin loop (agent_loop) |
Some(p), same session | Default | Regular continuation |
Some(p), same session | Rerun | Retry / error recovery |
Some(p), same session | Branch | Branch exploration |
Some(p), different session | Initial | Sub-agent loop (spawned by a tool) |
§Tree navigation
- Parent → children: iterate
children_loop_ids - Child → parent: read
parent_loop_id - Sub-agent children (cross-session): iterate
child_loop_refs
Fields§
§loop_id: StringUnique identifier for this loop execution.
session_id: StringSession this loop belongs to.
agent_id: StringAgent that ran this loop.
parent_loop_id: Option<String>loop_id of the loop that directly preceded this one (if any).
Nonefor origin loops (started byagent_loop).Some(id)for continuations started byagent_loop_continue.- For sub-agent loops,
parent_loop_idrefers to the tool call loop in a different session.
continuation_kind: ContinuationKindHow this loop relates to its parent.
Initialfor origin loops (agent_loop) and sub-agent loops.Defaultfor regular same-session continuations.Rerunfor retries / error recovery.Branch {..}for branch explorations.
started_at: DateTime<Utc>Timestamp from AgentStart.
ended_at: Option<DateTime<Utc>>Timestamp from AgentEnd (None while running or pending).
status: LoopStatus§rejection: Option<String>Set when AgentEnd.rejection is Some(_) (input filter blocked the run).
config: Option<LoopConfigSnapshot>Identifies the model and provider that ran this loop.
Populated from the first Message::Assistant seen in the loop.
None if the loop ended before any assistant message was produced.
messages: Vec<AgentMessage>All new messages produced by this loop — taken directly from AgentEnd.messages.
These are the authoritative messages for replay and branching. To resume
from a loop, reconstruct an AgentContext with the full message history
(prior loop messages + these) and call agent_loop_continue.
turns: Vec<Turn>Materialized turn records, one per LLM call-response cycle.
Built by [SessionRecorder] from TurnStart/TurnEnd event pairs.
Empty for old sessions that predate turn materialization, or for loops
that ended before any turn completed (rejected, aborted).
usage: UsageToken usage from AgentEnd.usage.
metadata: Option<Value>Opaque metadata passed to AgentStart by the caller (e.g. request id).
events: Vec<LoopEvent>Ordered event stream for this loop.
MessageUpdate (streaming delta) events are included only when
[SessionRecorderConfig::include_streaming_events] is true.
children_loop_ids: Vec<String>loop_ids of same-session child loops (continuations / reruns / branches).
This is the parent→children direction of the bidirectional loop tree.
The inverse (children → parent) is parent_loop_id.
Does not include cross-session sub-agent children — those are in
child_loop_refs.
child_loop_refs: Vec<ChildLoopRef>Cross-session links to sub-agent loops spawned by tool calls in this loop.
Each entry corresponds to a ToolExecutionEnd.child_loop_id that is
Some(_). Use the child_session_id to load the child Session.
parallel_group: Option<ParallelGroupRecord>Set when this loop was part of an evaluational-parallelism group.
compaction_block: Option<CompactionBlock>Non-destructive compaction overlay. When Some, the context loader
uses this block instead of raw self.messages. The original messages
remain untouched.
Implementations§
Trait Implementations§
Source§impl Clone for LoopRecord
impl Clone for LoopRecord
Source§fn clone(&self) -> LoopRecord
fn clone(&self) -> LoopRecord
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more