Skip to content

AgentStateSnapshot

junjo.agent.state.AgentStateSnapshot

Kind: Class

SDK version: 0.69.0

Documentation channel: Stable release

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)

View source

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.

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.

input: FrozenJsonValue

View source

Immutable JSON snapshot of the input admitted for this invocation.

history: tuple[FrozenJsonValue, ...]

View source

Immutable JSON snapshot of the supplied conversation history.

transcript: tuple[FrozenJsonValue, ...]

View source

Immutable normalized records of the messages and operations captured for this invocation.

model_iteration: int

View source

Current model iteration recorded at the time of the diagnostic snapshot.

model_request_count: int

View source

Number of model requests recorded during this invocation.

tool_call_requested_count: int

View source

Number of tool calls requested by model responses.

tool_call_admitted_count: int

View source

Requested tool calls accepted for execution by the Agent runtime.

tool_call_started_count: int

View source

Admitted tool calls whose execution started.

tool_call_completed_count: int

View source

Started tool calls whose execution completed.

usage: AgentUsage

View source

Aggregated provider-reported usage; unavailable fields remain absent rather than becoming zero.

admitted_tool_call_ids: tuple[str, ...]

View source

Tool-call identities accepted by the runtime in this invocation.

pending_tool_call_ids: tuple[str, ...]

View source

Admitted tool-call identities still awaiting completion at the snapshot.

completed_tool_call_ids: tuple[str, ...]

View source

Tool-call identities recorded as completed at the snapshot.

final_output_available: bool

View source

Whether a final output exists; distinguishes a valid JSON null output from unavailable output.

final_output: FrozenJsonValue

View source

Immutable final output JSON when available; interpret together with final_output_available.

terminal_reason: str | None

View source

Recorded terminal reason, or None if no terminal reason had been recorded.

to_json() -> dict[str, JsonValue]

View source

Return a detached contract projection suitable for telemetry/evals.