# ADR-0013: Pi-Subagents — Subagent Orchestration

**Status:** Accepted
**Date:** 2026-05-13
**Package:** `pi-subagents@0.24.2`
**Maintainer:** @nicobailon | **Repo:** github.com/nicobailon/pi-subagents
**Last published:** 2 days ago | **Publish cadence:** ~2-3/week

## Problem

Single-agent architecture fails on complex tasks. Manual text-based delegation has no structure, type safety, or progress tracking.

## Decision

Structured delegation primitives:

- **SINGLE**: `subagent({ agent, task })`
- **CHAIN**: sequential pipeline, `{previous}` + `{chain_dir}` handoff
- **PARALLEL**: concurrent with configurable concurrency
- **Fork context**: session branching
- **Async**: background runs with `status`/`resume`/`interrupt`
- **Intercom**: cross-agent communication
- Custom agents in `agents/` as Markdown + YAML frontmatter
- Preset chains as `.chain.md` (deterministic)

## Alternatives

| Approach         | Why Rejected                         |
| ---------------- | ------------------------------------ |
| No subagents     | Fails on complex tasks               |
| Text delegation  | No structure, no progress            |
| CrewAI / AutoGen | Heavy, Python-only, not agent-native |

## Trade-offs

pi-specific API. `fork` context and intercom add cognitive complexity for new users. `implement-validate` chain (worker → reviewer) is the primary pattern.

## References

- [npm](https://www.npmjs.com/package/pi-subagents)
- arXiv 2604.18071: "hierarchical and role-specialized patterns emerge with complexity"
- [STEM Agent](https://arxiv.org/abs/2603.22359) — modular architecture for specialized tasks
- [AgentOrchestra](https://arxiv.org/abs/2506.12508) — planning + modular collaboration
