Documentation Index
Fetch the complete documentation index at: https://qitor.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
StateSchema
StateSchema is the base class for your agent’s typed state. It acts as the single source of truth during a run — every hook in your AgentModule reads from and writes to it.
Built-in fields
| Field | Description |
|---|---|
task | The task string passed to init_state. Set automatically by the Engine. |
current_step | The current step index. Incremented by the Engine after each step. |
max_steps | Maximum steps allowed. Validated: must be > 0 and >= current_step. |
final_result | The agent’s final answer, as a string. Set to stop the run via FinalResultCriteria. |
stop_reason | Why the run ended. Set by state.set_stop() or the Engine on budget exhaustion. |
metadata | Freeform dict for any extra per-run context you want to carry. |
metrics | Freeform dict for tracking numeric measurements across steps. |
Subclassing StateSchema
Add your own fields by subclassingStateSchema. The Engine serializes state diffs into each step record using state.to_dict(), so all fields are captured in the trace automatically.
init_state:
Stopping the run
Callstate.set_stop() from within reduce (the hook that folds the step’s observation and decision back into state) to halt the run on the next stop check. It accepts a StopReason enum value or its string equivalent.
state.final_result triggers the default FinalResultCriteria stop condition, which is the preferred way to signal a successful completion:
Task
Task is a structured package that describes what the agent should do, what resources it needs, and what constraints apply. You can pass a Task anywhere agent.run() or Engine.run() accepts a task argument.
Task fields
| Field | Type | Description |
|---|---|---|
id | str | Unique run identifier. Used in trace artifacts. |
objective | str | The plain-text task instruction passed to init_state. |
resources | list[TaskResource] | Files, directories, URLs, or artifacts the agent needs. |
env_spec | EnvSpec | None | Declares the environment type and configuration. |
constraints | dict[str, Any] | Freeform key-value constraints communicated to the agent. |
success_criteria | list[str] | Human-readable criteria evaluated in TaskResult. |
budget | TaskBudget | Per-task budget that overrides the Engine’s default budget. |
inputs | dict[str, Any] | Structured input data available to the agent. |
metadata | dict[str, Any] | Freeform metadata stored in the trace manifest. |
TaskBudget
TaskBudget sets per-task limits on steps, wall-clock time, and tokens. When a Task is passed to Engine.run(), its budget takes precedence over the Engine’s default RuntimeBudget.
None inherits the Engine’s default.
TaskResource
TaskResource declares a file, directory, URL, or artifact that the task depends on. The Engine validates required resources before the loop starts.
kind values: "file", "dir", "url", "artifact".
Decision
Decision represents the output of a single decide step — the structured choice the agent makes about what to do next, whether that is calling tools, returning a final answer, waiting, or branching. It has four modes, each with a factory method.
- act
- final
- wait
- branch
Execute one or more tool actions.
Use the factory methods (
Decision.act(), Decision.final(), etc.) rather than constructing Decision directly. They validate required fields and set mode correctly.