Teams
Teams define coordinated multi-agent workflows. A team specifies which agents participate and how they collaborate.
Built-in Teams
Section titled “Built-in Teams”PanCode ships with two built-in team definitions:
code-review
Section titled “code-review”Developer writes code, reviewer checks it. Sequential workflow.
dev -> reviewerThe dev agent implements the task, then the reviewer agent analyzes the output for bugs, security issues, and improvements.
research-dev
Section titled “research-dev”Reviewer explores the codebase first, developer implements based on findings. Sequential workflow.
reviewer -> devThe reviewer agent explores and analyzes relevant code, then the dev agent uses those findings to implement changes with better context.
Team Definition Schema
Section titled “Team Definition Schema”interface TeamDefinition { name: string; // Team identifier description: string; // Human-readable purpose agents: string[]; // Ordered list of agent names workflow: "parallel" | "sequential" | "review";}Workflow Types
Section titled “Workflow Types”| Type | Behavior |
|---|---|
parallel | All agents run simultaneously on the same task |
sequential | Agents run in order. Each agent’s output feeds into the next. |
review | Primary agent does the work, review agent validates the output. |
Dispatch Primitives
Section titled “Dispatch Primitives”PanCode provides three dispatch tools that implement team-like coordination:
dispatch_agent (Single)
Section titled “dispatch_agent (Single)”Dispatch one agent for one task.
dispatch_agent(task: "Review config.ts", agent: "reviewer")batch_dispatch (Parallel)
Section titled “batch_dispatch (Parallel)”Run multiple tasks simultaneously across agents.
batch_dispatch(tasks: [ { task: "Review auth module", agent: "reviewer" }, { task: "Review config module", agent: "reviewer" }, { task: "Explore test coverage", agent: "scout" }])Each task gets its own worker subprocess. PanCode staggers launches to avoid resource contention.
dispatch_chain (Sequential Pipeline)
Section titled “dispatch_chain (Sequential Pipeline)”Run a multi-step pipeline where each step builds on the previous.
dispatch_chain(steps: [ { task: "Analyze the authentication flow", agent: "planner" }, { task: "Implement the proposed changes", agent: "builder" }, { task: "Review the implementation", agent: "reviewer" }])The chain stops if any step fails. Each step receives the output of the previous step as context.
Combining Teams with Modes
Section titled “Combining Teams with Modes”Team execution respects the current orchestrator mode:
| Mode | Team Behavior |
|---|---|
| Plan | Dispatch disabled. Use shadow agents for exploration. |
| Build | Full team execution. All agents available. |
| Review | Only readonly agents can be dispatched. |
| Admin | Full team execution with elevated permissions. |
In Review mode, a code-review team would fail on the dev step because dev is not readonly. Use this intentionally to restrict what teams can do in different contexts.
Worktree Isolation
Section titled “Worktree Isolation”Any dispatch (single, batch, or chain) can use worktree isolation:
dispatch_agent(task: "Refactor config.ts", agent: "builder", isolate: true)With isolation enabled:
- PanCode creates a git worktree for the worker
- The worker operates on the isolated copy
- On completion, delta patches are merged back to the main workspace
- The worktree is cleaned up
This prevents concurrent workers from interfering with each other’s file changes.
Monitoring Team Execution
Section titled “Monitoring Team Execution”/runs View all dispatch history/batches View batch dispatch history/cost Per-run cost breakdown/metrics Aggregate statistics/stoprun <id> Stop a running dispatchBudget and Admission
Section titled “Budget and Admission”Team dispatches go through the same admission pipeline as single dispatches:
- Safety pre-flight: Checks scope enforcement and loop detection
- Budget check: Verifies budget ceiling is not exceeded
- Recursion guard: Prevents unbounded subprocess trees (default max depth: 2)
- Path validation: Blocks scope violations and warns about missing files
See Also
Section titled “See Also”- Agents Guide: Agent definitions and configuration
- Multi-Agent Dispatch Tutorial: Practical dispatch patterns
- Commands Reference: All dispatch-related commands