Coordinator / Worker Pattern

One coordinator agent breaks a goal into subtasks and assigns them; worker agents execute independently. Implementation walkthrough, the coordinator's prompt design, and result aggregation.

The Coordinator Pattern

What you'll learn

Design a coordinator agent that manages a team of specialists, implement the pattern in Paperclip, and understand its strengths and failure modes.

What Is the Coordinator Pattern?

A coordinator is an agent whose job is not to do work directly, but to:
1. Accept a high-level goal
2. Decompose it into concrete subtasks
3. Assign subtasks to specialist agents
4. Monitor progress and assemble the final result

High-Level Goal
     │
     ▼
[Coordinator Agent]
  ├─► [Specialist A] → result A
  ├─► [Specialist B] → result B
  └─► [Specialist C] → result C
     │
     ▼
[Coordinator Agent] assembles final report

Coordinator System Prompt

You are a Task Coordinator at Acme Corp.

## Identity
You receive high-level project goals and decompose them into specific subtasks for specialist agents.

## Operating Rules
- Always output a JSON task plan, never prose
- Each subtask must be self-contained with a clear deliverable
- Assign each subtask to exactly one agent_role
- Keep subtask descriptions under 200 words

## Output Format
{
  "project_title": "...",
  "subtasks": [
    {
      "title": "...",
      "description": "...",
      "agent_role": "...",
      "priority": "medium",
      "depends_on": []
    }
  ]
}

Implementing Auto-Subtask Creation

Enable in Company Settings → Workflows → Auto-create subtasks from structured JSON results.

When enabled, Paperclip parses the coordinator's result JSON and:
1. Creates one issues row per subtask entry
2. Assigns each to an agent matching agent_role
3. Sets parent_issue_id to the coordinator's issue
4. Sets status = 'open' (or waits for depends_on issues to resolve first)

The Coordinator's Second Role: Assembly

After all subtasks are resolved, the coordinator receives a second invocation with all subtask results compiled in the task prompt:

All subtasks have been completed. Here are the results:

SUBTASK 1 — Research: [result text]
SUBTASK 2 — Analysis: [result text]
SUBTASK 3 — Writing: [result text]

Please assemble these into a final coherent report.

Failure Modes

Failure Impact Mitigation
Coordinator produces invalid JSON No subtasks created Add JSON validation in post-processor
Subtask assigned to non-existent role Issue stuck Use explicit assigned_agent_id instead of agent_role
Assembly step before all subtasks done Incomplete result Use depends_on trigger in workflow config

Checkpoint ✓

Sign in for progress tracking & Q&A →