Skip to main content
Advanced/compatible programmatic examples. Fragments illustrate mechanisms; HostEnv or workspace does not provide isolation. New projects start with Quickstart, Session and explicit resource configuration.
Build Your First Multi-Agent System in QitOS
This tutorial walks through building a multi-agent code exploration system that dispatches parallel sub-agents to investigate different parts of a codebase.

What You’ll Build

A coordinator agent that uses the fanout tool to spawn multiple explorer agents in parallel, each investigating a different directory. Results are aggregated and synthesized.

Prerequisites

  • QitOS installed (pip install qitos)
  • An OpenAI-compatible API key

Step 1: Define Your Sub-Agent

First, create an explorer agent that can investigate directories: Illustrative fragment (not a standalone program; use the complete example linked on this page).

Step 2: Register the Agent

Use AgentSpec and AgentRegistry to register your sub-agent: Illustrative fragment (not a standalone program; use the complete example linked on this page).

Step 3: Create the Coordinator

The coordinator agent has coding tools plus the fanout tool: Illustrative fragment (not a standalone program; use the complete example linked on this page).

Step 4: Run It

Illustrative fragment (not a standalone program; use the complete example linked on this page).
The LLM will call fanout(tasks=[{"agent":"explorer","task":"Explore /auth"}, ...]), spawning three parallel explorers.

Quick Start with Patterns

For common patterns, use the built-in templates: Illustrative fragment (not a standalone program; use the complete example linked on this page).

What’s Next

  • Try ContextStrategy.FULL to pass parent context to sub-agents
  • Use DelegateTool for 1:1 delegation with result return
  • Use Decision.handoff() for workflow-style agent chains