Basic usage
Run one iteration and keep the workspace:max_iterations is the number of iterations attempted by the current call.
It is not a new lifetime limit. The result distinguishes the two counts:
Resume flow
Validation happens before Kapso initializes or changes the experiment workspace. A failed resume request therefore does not create a Git repository, rename a branch, or overwrite campaign state.Strict requirements
Withresume=True:
output_pathis required and must already be a directory.- The path must be a non-bare Git repository.
.kapso/run_state.jsonmust exist.- The checkpoint schema must be supported and structurally valid.
- The goal, when passed, must match the checkpoint’s exactly; left out, it comes from the checkpoint.
- Every other launch argument comes from
.kapso/launch.jsonwhen left out. A passed mode, coding agent,eval_dir, config or knowledge index that differs from the record is refused, and the refusal names the setting. - The configured search strategy and configuration fingerprint must match.
- A campaign marked
completedcannot be resumed.
resume=True in a workspace that already has a run
checkpoint also fails. This prevents accidental replacement of a campaign.
Checkpoint contents
Kapso owns the checkpoint rather than delegating persistence to each strategy. The current schema is:eval_dir is provided, its content fingerprint is also part of strict
compatibility. Pass the same unchanged suite to every resumed call.
Atomic saves and iteration boundaries
The checkpoint is written to a temporary file in.kapso/, flushed, and then
installed with os.replace. If replacement is interrupted, the previous valid
checkpoint remains readable.
Kapso saves after every finalized iteration, including the iteration that
achieves the goal. It records only nodes returned as completed by the strategy;
a half-created iteration is not added to completed_iterations.
Status has two values:
running: the call reached its iteration slice and can be resumed. A budget stop staysrunningtoo — it records why inlast_stopand waits for the next slice. A campaign that paused for a reply in the inbox staysrunningwithlast_stop: "waiting_for_user"; resuming it with the request still open pauses again without running anything. See the inbox.completed: the goal was achieved. Only goal achievement completes a campaign.
What is restored
Resume restores:- generic-search node history and next iteration number;
- feedback injected into the next iteration;
- the durable clock (
elapsed_seconds) and cumulative campaign cost, broken down incost_by_component; - cumulative completed-iteration count;
- the status needed to reject completed campaigns.
.kapso/experiment_history.json is loaded
by the normal history store.
Failure handling
Resume errors are available from the top-levelkapso package:
Fix the mismatch or choose the correct workspace. Do not delete validation
fields to force a resume; use a new output path for a new campaign.
Custom search strategies
A resumable custom strategy implements JSON-compatible state methods:load_state().
Related
Execution flow
What a checkpoint captures
CLI reference
The —resume flag
Inbox
The pause a reply resumes
pip install leeroo-kapso · Every page as plain text: llms.txt.