Use this file to discover all available pages before exploring further.
qitos.kit provides concrete, reusable building blocks for common agent authoring patterns. All components attach to the AgentModule + Engine pipeline and do not introduce a second orchestrator.Key terms used on this page:
parser: a component that converts raw model output into a typed Decision
protocol: the output format the model is asked to follow
transport: the adapter that sends requests to and receives responses from a model API
harness: the wiring layer that connects a transport, parser, and protocol into a coherent model-facing configuration
preset: a reusable configuration bundle for a model family
critic: a module that evaluates each step and can trigger retries or stops
trace: a structured log of all run events and steps
from qitos.kit import ReActTextParser, WindowMemory, CodingToolSet, ...
ScreenshotEnv for screenshot-first multimodal and GUI-adjacent workflows
DesktopEnv for OSWorld-inspired desktop and computer-use loops
TextWebEnv for text-browser-style web observation
TmuxEnv for interactive terminal workflows
ScreenshotEnv is the first built-in multimodal environment. Use it when you want to test screenshot-based reasoning, visual-web prompting, or the new qita visual-asset path without committing to a full benchmark adapter.DesktopEnv builds on the same multimodal core but adds an OSWorld-style desktop lane: screenshot + accessibility + terminal observation, GUI controller ops, and container-first provider boundaries.
DynamicTreeSearch for branch selection and search-driven agents
Parsers
History & Compaction
Memory
Tool Sets
Individual Tools
Planning
Critics
Models
Parsers convert raw LLM output strings into typed Decision objects. Choose the parser that matches the output format your prompt requests.
Prompt format and parser must match exactly. If your prompt asks for Thought: / Action: blocks, use ReActTextParser. If it asks for JSON, use JsonDecisionParser. If it asks for XML, use XmlDecisionParser.
ReActTextParser
Parses ReAct-style text output with labeled blocks such as Thought: and Action:.
from qitos.kit import ReActTextParserclass ReActTextParser(BaseParser[dict[str, Any]])
from qitos.kit import ReActTextParserparser = ReActTextParser()# Expects output like:# Thought: I should search for the answer.# Action: search(query="QitOS architecture")
Pass parser to AgentModule.run() or the Engine constructor.
JsonDecisionParser
Parses JSON-formatted model output. Supports mode field ("act", "final", "wait") and configurable key names.
from qitos.kit import JsonDecisionParserclass JsonDecisionParser(BaseParser[dict[str, Any]])
Same parameter names as ReActTextParser. All keys default to the same values.Usage
from qitos.kit import JsonDecisionParserparser = JsonDecisionParser()# Expects output like:# {"thought": "I need to search.", "action": {"name": "search", "args": {"query": "..."}}}
XmlDecisionParser
Parses XML-formatted model output. Supports both XML mode attribute and configurable tag names.
from qitos.kit import XmlDecisionParserclass XmlDecisionParser(BaseParser[dict[str, Any]])
xml_*_tags take priority over *_keys for XML parsing. Defaults: xml_think_tags=("think", "thought", "thinking", "rationale"), xml_action_tags=("action", "tool", "call"), xml_final_tags=("final_answer", "final", "answer").Usage
from qitos.kit import XmlDecisionParserparser = XmlDecisionParser()# Expects output like:# <response mode="act"># <think>I should search.</think># <action name="search"><query>QitOS docs</query></action># </response>
TerminusJsonParser / TerminusXmlParser
Terminus parsers are specialized variants that handle agent formats with explicit <terminus> or JSON-level termination signals. Use them with their matching system prompts (TERMINUS_JSON_SYSTEM_PROMPT, TERMINUS_XML_SYSTEM_PROMPT).
from qitos.kit import TerminusJsonParser, TerminusXmlParser
Both share the same constructor signature as JsonDecisionParser and XmlDecisionParser respectively.
Long-running context management in QitOS is a first-class authoring concern.The key separation is:
History controls what goes back into the next model call
Memory stores useful records outside the immediate chat window
MessageGrouper groups messages into compactable rounds. It prefers grouping by step when possible, and falls back to assistant-boundary grouping otherwise.This matters because QitOS compacts context in ways that preserve the structure of an agent trajectory (the sequence of observations and decisions across steps).
Memory adapters implement qitos.Memory and give your agent persistent recall across steps.
WindowMemory
Keeps the last N records in memory. Oldest records are dropped when the window overflows.
from qitos.kit import WindowMemory
Constructor
def __init__(self, window_size: int = 20)
Parameter
Default
Description
window_size
20
Maximum number of records to retain in memory
Usage
from qitos.kit import WindowMemorymemory = WindowMemory(window_size=30)agent = MyAgent(memory=memory, ...)
SummaryMemory
Keeps the last N records in memory and compresses older records into a summary string when evict() is called.
from qitos.kit.memory import SummaryMemory
Constructor
def __init__(self, keep_last: int = 10)
Parameter
Default
Description
keep_last
10
Number of recent records to keep verbatim
When evict() runs, records beyond keep_last are pipe-joined into self._summaries for later retrieval via summarize().
MarkdownFileMemory
Persists all memory records to a local markdown file in an append-only format. Useful for debugging and long-running agents that need durable memory.
from qitos.kit import MarkdownFileMemory
Constructor
def __init__(self, path: str = "memory.md", max_in_memory: int = 200)
Parameter
Default
Description
path
"memory.md"
Path to the markdown file (created if absent)
max_in_memory
200
Maximum records held in memory; older records are dropped from RAM but remain on disk
Each appended record is written as a markdown section:
</Accordion><Accordion title="VectorMemory">Stores records in an in-process embedding index and retrieves the top-K most similar records for a given query.```pythonfrom qitos.kit.memory import VectorMemory
Utility tool used by benchmark-style agents to submit a final candidate answer or flag.
from qitos.kit.tool.cybench import SubmitAnswer
This is especially useful in CyBench-like settings where the agent must explicitly hand over a candidate result through a tool call rather than only return a final natural-language answer.
SendTerminalKeys
Send keystrokes to a terminal session (tmux or similar).
from qitos.kit import SendTerminalKeys
Useful for agents that need to interact with a long-running terminal process.
Planning helpers for building structured plans and search-driven agents.
NumberedPlanBuilder
Calls an LLM to generate a numbered plan from a prompt.
from qitos.kit import NumberedPlanBuilder
Constructor
def __init__(self, system_prompt: str = "Return a numbered plan only.")
build(llm, prompt, extra_messages=None) -> List[str]Calls llm with the system prompt and user prompt, then parses lines matching 1. ..., 2. ... etc. Returns the list of step strings.Usage
from qitos.kit import NumberedPlanBuilderbuilder = NumberedPlanBuilder()plan = builder.build(llm=agent.llm, prompt="How to analyse a Python codebase?")# ["Read the directory structure", "Identify entry points", ...]
Adaptive tree search that maintains a frontier of unexplored candidates and selects branches by score plus novelty bonus.
from qitos.kit import DynamicTreeSearch
Constructor
def __init__( self, top_k: int = 3, max_frontier: int = 64, score_key: str = "score", exploration_bonus: float = 0.25,)
Parameter
Default
Description
top_k
3
Candidates to keep per expansion
max_frontier
64
Maximum frontier size
score_key
"score"
Key in Decision.meta to read as base score
exploration_bonus
0.25
Bonus added for less-visited candidates
Pass it to Engine(search=DynamicTreeSearch(...)) or AgentModule.run(search=...).
State ops
Lightweight helpers for safely updating common state fields:
from qitos.kit.planning import append_log, format_action, set_final, set_if_empty# Append a message to state.log (creates the list if absent)append_log(state, "step completed")# Render an action dict as a readable stringlabel = format_action({"name": "search", "args": {"query": "foo"}})# Set state.final_result and stop_reasonset_final(state, result="Done", reason=StopReason.SUCCESS)# Set a field only if it is currently falsyset_if_empty(state, "plan", [])
Critics evaluate each step’s decision and action results, and can signal continue, retry, or stop to the Engine.
ReActSelfReflectionCritic
Generates reflection notes when tool calls fail and triggers retries up to a configurable limit.
from qitos.kit import ReActSelfReflectionCritic
Constructor
def __init__(self, max_retries: int = 2)
Parameter
Default
Description
max_retries
2
Maximum retry attempts before signalling stop
Behaviour
If any action result contains an "error" key: writes a structured reflection to state.metadata["self_reflections"] and returns action="retry".
After max_retries failed attempts: returns action="stop".
On a Decision.final() without errors: appends a pass note and returns action="continue".
Usage
from qitos.kit import ReActSelfReflectionCriticcritic = ReActSelfReflectionCritic(max_retries=3)agent.run(task="...", critics=[critic])
SelfReflectionCritic
General-purpose self-reflection critic. Checks action results and produces structured feedback without the ReAct-specific format assumptions.
from qitos.kit.critic import SelfReflectionCritic
PassThroughCritic
A no-op critic that always returns action="continue". Useful as a placeholder during development.
from qitos.kit.critic import PassThroughCritic
The models module provides concrete LLM callables compatible with AgentModule.llm.For v0.4 research authoring, prefer the family-preset layer when you want one agent to switch across model families:
from qitos.harness import build_harness_policy, build_model_for_preset
Use OpenAICompatibleModel(...) directly when you are hand-authoring a single transport path.
OpenAICompatibleModel
Works with any OpenAI-compatible API endpoint — including SiliconFlow, Azure OpenAI, Tongyi, Zhipu AI, LM Studio, vLLM, and LocalAI.