Skip to main content

Module loop_checkpoint

Module loop_checkpoint 

Source
Expand description

Per-tool-round loop checkpoints for crash-tolerant runs (P3 cut 1).

The agent loop persists a LoopCheckpoint after each completed tool round. The checkpoint captures the minimum state needed to recreate the loop’s position so a future process — typically on a different node, dispatched by the host after a crash or planned migration — can resume from the last consistent boundary.

Boundary policy: checkpoints are taken only between tool rounds, never mid-tool. If a process dies while a tool is executing, the work of that round is lost on resume; the LLM re-deliberates from the previous checkpoint. This trades retry cost for correctness — re-executing a non-idempotent tool (write, bash) on the wrong side of the boundary is worse than re-asking the LLM.

crate::AgentSession::resume_run restores the checkpoint on a fresh run while preserving cumulative usage, turn budgets, and convergence guards.

Structs§

LoopCheckpoint
Snapshot of the agent loop at the boundary between tool rounds.
LoopConvergenceState
Loop state that must survive crash recovery to preserve convergence limits.
SessionStoreCheckpointSink
Default adapter that forwards checkpoints to a SessionStore. Construct via SessionStoreCheckpointSink::new.

Constants§

LOOP_CHECKPOINT_SCHEMA_VERSION
Schema version. Bumped on incompatible format changes; impls of LoopCheckpointSink should reject loads from a future version.

Traits§

LoopCheckpointSink
Receiver of per-tool-round checkpoints.