Use this file to discover all available pages before exploring further.
Every QitOS agent follows one execution path: AgentModule + Engine + Trace (a trace is the structured log of decisions, actions, and observations recorded during a run). You define the strategy; the Engine owns the loop. This guide walks through that path using the minimal coding agent from examples/quickstart/minimal_agent.py.
reduce() (the method that folds the latest observation and decision back into agent state) is where QitOS turns tool results into agent progress:
def reduce( self, state: MinimalCodingState, observation: dict[str, Any], decision: Decision[Action], # the structured output from the model ) -> MinimalCodingState: action_results = observation.get("action_results", []) if decision.rationale: state.scratchpad.append(f"Thought: {decision.rationale}") if decision.actions: state.scratchpad.append(f"Action: {format_action(decision.actions[0])}") if action_results: first = action_results[0] state.scratchpad.append(f"Observation: {first}") if isinstance(first, dict) and int(first.get("returncode", 1)) == 0: state.final_result = "Patch applied and verification passed." return state
You must return state from reduce. Forgetting to return it is still the most common mistake.
5
Seed a workspace and run the agent
The minimal example creates one tiny buggy file, then asks the agent to fix it:
from pathlib import PathWORKSPACE = Path("./playground/minimal_coding_agent")TARGET_FILE = "buggy_module.py"TASK = "Fix the bug in buggy_module.py and make the verification command pass."def seed_workspace() -> None: WORKSPACE.mkdir(parents=True, exist_ok=True) target = WORKSPACE / TARGET_FILE if not target.exists(): target.write_text("def add(a, b):\n return a - b\n", encoding="utf-8")def main() -> None: seed_workspace() agent = MinimalCodingAgent(llm=build_model(), workspace_root=str(WORKSPACE)) result = agent.run( task=TASK, workspace=str(WORKSPACE), max_steps=8, target_file=TARGET_FILE, return_state=True, ) print("final_result:", result.state.final_result) print("stop_reason:", result.state.stop_reason)
6
Inspect the run with qita
qita board --logdir ./runs
The board starts on http://127.0.0.1:8765. Use it to inspect the patching trajectory (the ordered sequence of steps the agent took), replay the run, and export the trace as HTML.