Skip to main content
Version: latest

agrag.agents.middleware.RunState

RunState(max_tool_calls:int, tool_calls:int = 0, budget_exhausted:bool = False, recording_failed:bool = False, recording_failures:list[str] = list(), retrieval_failed:bool = False, fetched_ids:list[str] = list(), fetches:dict[str, Any] = dict(), open_steps:dict[str, StepKind] = dict()) -> None

Mutable facts accumulated by tools and middleware during one run.

Attributes:

  • max_tool_calls (int) – Tool calls allowed in the run.
  • tool_calls (int) – Tool calls admitted so far.
  • budget_exhausted (bool) – Whether the run reached its tool-call bound.
  • recording_failed (bool) – Whether an event or decision write did not complete.
  • recording_failures (list[str]) – Descriptions of the writes that did not complete.
  • retrieval_failed (bool) – Whether a search leg failed or a result was truncated.
  • fetched_ids (list[str]) – Evidence ids fetched in this run with complete text.
  • fetches (dict[str, Any]) – Fetch outcomes by evidence id.
  • open_steps (dict[str, StepKind]) – Steps this run set in progress and has not yet resolved, by name, with their kind.

Functions:

  • fail_recording – Mark that a write did not complete and keep its description.

budget_exhausted​

budget_exhausted: bool = False

fail_recording​

fail_recording(description:str) -> None

Mark that a write did not complete and keep its description.

fetched_ids​

fetched_ids: list[str] = field(default_factory=list)

fetches​

fetches: dict[str, Any] = field(default_factory=dict)

max_tool_calls​

max_tool_calls: int

open_steps​

open_steps: dict[str, StepKind] = field(default_factory=dict)

recording_failed​

recording_failed: bool = False

recording_failures​

recording_failures: list[str] = field(default_factory=list)

retrieval_failed​

retrieval_failed: bool = False

tool_calls​

tool_calls: int = 0