RunState#
- class scikitplot.agent.RunState(run_id, goal, status=RunStatus.RUNNING, stop_reason=None, steps=<factory>, spent=<factory>, answer=None, pending=None, in_flight=None, error=None, audit_head=None)[source]#
The whole of one run, saved after every step.
- Parameters:
- run_idstr
64 hexadecimal digits.
- goalstr
What the run is for, as given to
Agent.run.- statusRunStatus, default=”running”
- stop_reasonStopReason or None, default=None
Set whenever
statusis notrunning.- stepslist of Step
- spentSpent
- answerobject, default=None
The accepted answer, for a completed run.
- pendingApprovalRequest or None, default=None
The action waiting for approval, for a paused run.
- in_flightdict or None, default=None
{"step", "key", "idempotent", "attempt", "decision", "gates"}while a tool call runs; a state saved with it set is a run that stopped during the call.- errorAgentError or None, default=None
Why the run failed or stopped.
- audit_headdict or None, default=None
{"seq", "digest"}of the run’s last audit record, so a resumed run continues the same hash chain.
- Parameters:
Notes
User. A planner receives a copy of the state rebuilt from its JSON form, so it reads exactly what was saved and cannot change the run.
- check()[source]#
Check that the state is one a run can be in.
- Raises:
- StateError
If the status and the stop reason disagree; the steps are not numbered 0, 1, …; a pending request or an in-flight call is not for the next step of this run; a completed run does not end with its accepted answer; or
spent.stepsis not the number of decisions the steps account for.
- Return type:
None
- error: AgentError | None = None#
- pending: ApprovalRequest | None = None#
- stop_reason: StopReason | None = None#