plexus.cli.procedure.lua_dsl.primitives.step module
Step primitive for checkpointed operations.
Provides Step.run() for checkpointing arbitrary operations that aren’t agent turns.
- class plexus.cli.procedure.lua_dsl.primitives.step.CheckpointPrimitive(execution_context)
Bases:
objectCheckpoint management primitive.
Provides checkpoint inspection and clearing operations for testing.
Initialize Checkpoint primitive.
- Args:
execution_context: ExecutionContext instance
- __init__(execution_context)
Initialize Checkpoint primitive.
- Args:
execution_context: ExecutionContext instance
- clear_after(name: str) None
Clear checkpoint and all subsequent ones.
- Args:
name: Checkpoint name to clear from
- Example:
Checkpoint.clear_after(“evaluate_candidate_1”)
- clear_all() None
Clear all checkpoints. Restarts procedure from beginning.
- Example:
Checkpoint.clear_all()
- exists(name: str) bool
Check if checkpoint exists.
- Args:
name: Checkpoint name
- Returns:
True if checkpoint exists
- Example:
- if Checkpoint.exists(“load_champion”) then
– Already loaded
end
- get(name: str) Any | None
Get cached checkpoint value.
- Args:
name: Checkpoint name
- Returns:
Cached value or None if not found
- Example:
local cached = Checkpoint.get(“evaluate_champion”) if cached then
use_cached_value(cached)
end
- class plexus.cli.procedure.lua_dsl.primitives.step.StepPrimitive(execution_context)
Bases:
objectStep primitive for checkpointing operations.
- Example usage:
- local metrics = Step.run(“evaluate_champion”, function()
- return Tools.plexus_run_evaluation({
score_id = params.score_id, version = “champion”
})
end)
On first execution: runs the function and caches result On replay: returns cached result without re-executing
Initialize Step primitive.
- Args:
execution_context: ExecutionContext instance for checkpoint operations
- __init__(execution_context)
Initialize Step primitive.
- Args:
execution_context: ExecutionContext instance for checkpoint operations
- run(name: str, fn: Callable[[], Any]) Any
Execute function with checkpointing.
- Args:
name: Unique checkpoint name fn: Function to execute (must be deterministic)
- Returns:
Result of fn() on first execution, cached result on replay