AgentStateSnapshot
junjo.agent.state.AgentStateSnapshot
Kind: Class
SDK version: 0.69.0
Documentation channel: Stable release
Signature
Section titled “Signature”AgentStateSnapshot(*, input: object, history: Sequence[object], transcript: Sequence[object], model_iteration: int, model_request_count: int, tool_call_requested_count: int, tool_call_admitted_count: int, tool_call_started_count: int, tool_call_completed_count: int, usage: AgentUsage, admitted_tool_call_ids: Sequence[str], pending_tool_call_ids: Sequence[str], completed_tool_call_ids: Sequence[str], final_output_available: bool, final_output: object, terminal_reason: str | None)Detached state evidence exposed by admitted failures and cancellation.
Snapshots contain only portable immutable JSON, immutable usage facts, and
validated counters. They never expose the private mutable AgentStore
state object used by the execution kernel.
Constructor
Section titled “Constructor”Create detached immutable evidence for one admitted execution.
Every JSON value is copied and frozen. Counters, usage, final-output availability, and admitted/pending/completed Tool identities are validated as one coherent snapshot.
Members
Section titled “Members”input: FrozenJsonValueImmutable JSON snapshot of the input admitted for this invocation.
history
Section titled “history”history: tuple[FrozenJsonValue, ...]Immutable JSON snapshot of the supplied conversation history.
transcript
Section titled “transcript”transcript: tuple[FrozenJsonValue, ...]Immutable normalized records of the messages and operations captured for this invocation.
model_iteration
Section titled “model_iteration”model_iteration: intCurrent model iteration recorded at the time of the diagnostic snapshot.
model_request_count
Section titled “model_request_count”model_request_count: intNumber of model requests recorded during this invocation.
tool_call_requested_count
Section titled “tool_call_requested_count”tool_call_requested_count: intNumber of tool calls requested by model responses.
tool_call_admitted_count
Section titled “tool_call_admitted_count”tool_call_admitted_count: intRequested tool calls accepted for execution by the Agent runtime.
tool_call_started_count
Section titled “tool_call_started_count”tool_call_started_count: intAdmitted tool calls whose execution started.
tool_call_completed_count
Section titled “tool_call_completed_count”tool_call_completed_count: intStarted tool calls whose execution completed.
usage: AgentUsageAggregated provider-reported usage; unavailable fields remain absent rather than becoming zero.
admitted_tool_call_ids
Section titled “admitted_tool_call_ids”admitted_tool_call_ids: tuple[str, ...]Tool-call identities accepted by the runtime in this invocation.
pending_tool_call_ids
Section titled “pending_tool_call_ids”pending_tool_call_ids: tuple[str, ...]Admitted tool-call identities still awaiting completion at the snapshot.
completed_tool_call_ids
Section titled “completed_tool_call_ids”completed_tool_call_ids: tuple[str, ...]Tool-call identities recorded as completed at the snapshot.
final_output_available
Section titled “final_output_available”final_output_available: boolWhether a final output exists; distinguishes a valid JSON null output from unavailable output.
final_output
Section titled “final_output”final_output: FrozenJsonValueImmutable final output JSON when available; interpret together with final_output_available.
terminal_reason
Section titled “terminal_reason”terminal_reason: str | NoneRecorded terminal reason, or None if no terminal reason had been recorded.
to_json
Section titled “to_json”to_json() -> dict[str, JsonValue]Return a detached contract projection suitable for telemetry/evals.