Runtime state for a single ReAct run.
Summary
Functions
Advances the event sequence counter to seq when it is ahead of the current
value, leaving it untouched otherwise.
Increments the event sequence counter and returns {state, next_seq}.
Clears all pending tool calls.
Clears streaming accumulators before a new LLM turn starts.
Returns elapsed runtime in milliseconds.
Restores state from a minimal checkpoint map.
Increments the reasoning iteration counter.
Merges usage counters into existing state usage map.
Returns the minimal serializable map required to resume execution.
Creates initial runtime state for a new query.
Stores terminal error value.
Stores the current LLM call id.
Stores the latest provider response id for multi-turn continuation.
Stores structured output metadata.
Replaces pending tool calls.
Stores terminal result value.
Sets runtime status.
Returns the Zoi schema used to validate ReAct runtime state.
Types
@type t() :: %Jido.AI.Reasoning.ReAct.State{ active_tools: map(), context: any(), error: nil | nil | any(), iteration: integer(), llm_call_id: nil | nil | binary(), llm_response_id: nil | nil | binary(), output: map(), pending_tool_calls: [ %Jido.AI.Reasoning.ReAct.PendingToolCall{ arguments: map(), attempts: integer(), duration_ms: nil | integer(), id: binary(), name: binary(), result: nil | any(), status: atom() } ], prev_tool_signature: nil | nil | any(), request_id: binary(), result: nil | nil | any(), run_id: binary(), seq: integer(), started_at_ms: integer(), status: atom(), streaming_text: binary(), streaming_thinking: binary(), updated_at_ms: integer(), usage: map(), version: integer() }
Functions
Advances the event sequence counter to seq when it is ahead of the current
value, leaving it untouched otherwise.
Used to reconcile sequence numbers allocated out-of-band by the tool-execution
heartbeat (which runs in a separate process while the runner is blocked inside
Task.async_stream). Adopting the heartbeat's final seq guarantees the next
normal event the runner emits is strictly greater than every keepalive,
preserving the monotonic-and-unique seq invariant.
@spec bump_seq(t()) :: {t(), pos_integer()}
Increments the event sequence counter and returns {state, next_seq}.
Clears all pending tool calls.
Clears streaming accumulators before a new LLM turn starts.
@spec duration_ms(t()) :: non_neg_integer()
Returns elapsed runtime in milliseconds.
Restores state from a minimal checkpoint map.
Increments the reasoning iteration counter.
Merges usage counters into existing state usage map.
Returns the minimal serializable map required to resume execution.
Creates initial runtime state for a new query.
Stores terminal error value.
Stores the current LLM call id.
Stores the latest provider response id for multi-turn continuation.
Stores structured output metadata.
@spec put_pending_tools(t(), [Jido.AI.Reasoning.ReAct.PendingToolCall.t()]) :: t()
Replaces pending tool calls.
Stores terminal result value.
Sets runtime status.
@spec schema() :: term()
Returns the Zoi schema used to validate ReAct runtime state.