Skip to main content
Mibyan can spawn isolated child agents to work on tasks in parallel. Each subagent gets its own conversation, terminal session, and toolset. Only the final summary comes back — intermediate tool calls never enter your context window. For the full feature reference, see Subagent Delegation.

When to Delegate

Good candidates for delegation:
  • Reasoning-heavy subtasks (debugging, code review, research synthesis)
  • Tasks that would flood your context with intermediate data
  • Parallel independent workstreams (research A and B simultaneously)
  • Fresh-context tasks where you want the agent to approach without bias
Use something else:
  • Single tool call → just use the tool directly
  • Mechanical multi-step work with logic between steps → execute_code
  • Tasks needing user interaction → subagents can’t use clarify
  • Quick file edits → do them directly
  • Durable long-running work that must survive session closure or process restart → cronjob_manage or terminal(background=True, notify_on_complete=True). Top-level delegation is asynchronous but still process-local.

Pattern: Parallel Research

Research three topics simultaneously and get structured summaries back:
Behind the scenes, Mibyan uses:
All three run concurrently. Each subagent searches the web independently and returns a summary. The parent agent then synthesizes them into a coherent briefing.

Pattern: Code Review

Delegate a security review to a fresh-context subagent that approaches the code without preconceptions:
The key is the context field — it must include everything the subagent needs:
The Context ProblemSubagents know absolutely nothing about your conversation. They start completely fresh. If you delegate “fix the bug we were discussing,” the subagent has no idea what bug you mean. Always pass file paths, error messages, project structure, and constraints explicitly.

Pattern: Compare Alternatives

Evaluate multiple approaches to the same problem in parallel, then pick the best:
Each subagent researches one option independently. Because they’re isolated, there’s no cross-contamination — each evaluation stands on its own merits. The parent agent gets all three summaries and makes the comparison.

Pattern: Multi-File Refactoring

Split a large refactoring task across parallel subagents, each handling a different part of the codebase:
Each subagent gets its own terminal session. They can work on the same project directory without stepping on each other — as long as they’re editing different files. If two subagents might touch the same file, handle that file yourself after the parallel work completes.

Pattern: Gather Then Analyze

Use execute_code for mechanical data gathering, then delegate the reasoning-heavy analysis:
This is often the most efficient pattern: execute_code handles the 10+ sequential tool calls cheaply, then a subagent does the single expensive reasoning task with a clean context.

Inherited Tool Access

Subagents inherit the parent’s enabled toolsets. delegate_task does not accept a model-facing toolsets parameter, so delegated work cannot grant itself capabilities that the parent does not have. Configure the parent’s tools before starting the conversation when a delegated task needs web, terminal, file, or other access. Mibyan still strips child-blocked tools such as clarify, memory, and send_message; children keep execute_code for programmatic tool calling.

Constraints

  • Default 10 parallel tasks: batches default to 10 concurrent subagents (configurable via delegation.max_concurrent_children in config.yaml, no hard ceiling, only a floor of 1)
  • Nested delegation is opt-in: leaf subagents (default) cannot call delegate_task, clarify, memory, or execute_code. Orchestrator subagents (role="orchestrator") retain delegate_task for further delegation, but only when delegation.max_spawn_depth is raised above the default of 1 (floor 1, no ceiling); the other three remain blocked. Disable globally via delegation.orchestrator_enabled: false.

Tuning Concurrency and Depth

Example: running 30 parallel workers with nested subagents:
  • Separate terminals — each subagent gets its own terminal session with separate working directory and state
  • No conversation history — subagents see only the goal and context the parent agent passes when calling delegate_task
  • Default 250 iterations — set delegation.max_iterations lower in config.yaml for fleets of simple tasks to save cost
  • Not durable — top-level delegation runs in the background and posts its result back later, but it remains tied to the owning session and Mibyan process. Session closure, /stop, /new, or a process restart can cancel or strand in-progress work. Use cronjob_manage or terminal(background=True, notify_on_complete=True) for work that must survive those boundaries.

Tips

Be specific in goals. “Fix the bug” is too vague. “Fix the TypeError in api/handlers.py line 47 where process_request() receives None from parse_body()” gives the subagent enough to work with. Include file paths. Subagents don’t know your project structure. Always include absolute paths to relevant files, the project root, and the test command. Use delegation for context isolation. Sometimes you want a fresh perspective. Delegating forces you to articulate the problem clearly, and the subagent approaches it without the assumptions that built up in your conversation. Check results. Subagent summaries are just that — summaries. If a subagent says “fixed the bug and tests pass,” verify by running the tests yourself or reading the diff. Failures are surfaced. A subagent that dies (provider error, timeout, crash) is reported with a clean one-line notice — ⚠️ Subagent failed — "your goal": <reason> — in the CLI delegation tree and as a chat notice on gateway platforms, even when tool progress is turned off. The parent agent also receives the full error in the tool result.
For the complete delegation reference — all parameters, ACP integration, and advanced configuration — see Subagent Delegation.