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 书安OS 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.
Resume API (cut 2 follow-up): not part of this cut. This module
lands the data contract + persistence wiring; an
AgentSession::resume_run(run_id) entry point will live on top.
Structs§
- Loop
Checkpoint - Snapshot of the agent loop at the boundary between tool rounds.
- Session
Store Checkpoint Sink - Default adapter that forwards checkpoints to a
SessionStore. Construct viaSessionStoreCheckpointSink::new.
Constants§
- LOOP_
CHECKPOINT_ SCHEMA_ VERSION - Schema version. Bumped on incompatible format changes; impls of
LoopCheckpointSinkshould reject loads from a future version.
Traits§
- Loop
Checkpoint Sink - Receiver of per-tool-round checkpoints.