Multi-Agent Workflow Design with Handoff Contracts
Get a buildable agent workflow spec: split verdict, pattern, typed handoff contracts, failure rules, model tiers, and a cost budget.
Before & after
Same prompt, same agent — the only difference is the skill.
Multi-agent systems can be complex. You'd want to think about how agents hand off work to each other, what information gets passed along, and what happens if something fails. Different architectures work for different problems. What are you trying to accomplish with multiple agents?
MULTI-AGENT WORKFLOW ARCHITECTURE: PATTERN CHOICE: 1. SEQUENTIAL (Agent A → B → C, output of A feeds B) → Best for: Reasoning chains (research → analyze → write) → Context: Pass full previous output + 1-line task summary → Failure: If B fails, retry B; don't restart A → Example: Research agent gathers facts → Analyst scores them → Writer creates article 2. PARALLEL (Agent A, B, C all run, results merged) → Best for: Independent analyses (code review + security scan + performance test) → Context: Each agent gets same input, merge-step synthesizes → Failure: If 1 agent fails, continue with 2 results (mark as partial) → Cost: 3x tokens (3 agents running), but 3x faster wall-clock time 3. HIERARCHICAL (Manager → delegates specialized agents) → Best for: Complex problems (manager decides which expert to call) → Context: Manager sees agent outputs, decides next step → Failure: Manager failure = whole pipeline blocked (single point) → Example: Manager reads code → calls security expert OR performance expert based on risk HANDOFF CONTRACTS: → Between agents: Define expected input shape (JSON schema) → Track context tokens per agent (prevent explosion) → Agent 1 output: Explicit pass/fail + data or error reason → Error case: If Agent 2 can't parse input, return structured error, don't hallucinate FAILURE HANDLING: • Retry logic: 2 automatic retries on transient errors (network, timeout) • Fallback: If Agent A fails 3x, skip and pass raw data to Agent B (marked as incomplete) • Logging: Every handoff logged (timestamp, tokens used, success/failure) CONTEXT BUDGET: • Total: 80K tokens for full pipeline • Per agent: 20K max (prevents runaway) • Compression: Summarize mid-results before next agent (cut irrelevant detail) COST MONITORING: → Track cost per workflow run (e.g., code review = 0.85 cents average) → Alert if single run exceeds 2x average (signal of infinite loop or bug)
About this skill
Your agent pipeline works in the demo, then in production the writer invents facts the researcher never found, the orchestrator loops until it burns your budget, and a retry sends the same email twice. This skill designs the workflow so each of those failures has a named owner and a rule: it decides whether you need multiple agents at all, then types every handoff, caps every loop, and gates every irreversible action.
What it does
- Gives a split-or-don't verdict based on context, permission, parallelism, cost, and verification needs, not on persona roles
- Picks the coordination pattern (chain, fan-out/fan-in, router, orchestrator-workers, evaluator loop) from your actual dependency graph
- Writes typed handoff contracts with status enums, evidence IDs, size caps, and code-side validation
- Builds a per-edge failure matrix: what to retry, what to escalate, and where global step and cost caps end the run
- Places side effects last behind idempotency keys and approval gates, and isolates agents that read untrusted content
- Shows token and cost-per-run arithmetic with model tiers assigned per role
What you get
A compact workflow spec: verdict, pattern, agent table with briefs and stop conditions, handoff schemas, failure matrix, budget, and an eval plan. For quick questions or a single broken handoff, you get a targeted fix instead of the full spec.
Best for
Engineers building LLM agent pipelines in Claude Code, the Claude Agent SDK, LangGraph, or similar frameworks, and teams refactoring a single overloaded agent that has become slow, expensive, or unreliable.
SKILL.md preview
---
name: multi-agent-workflow-design
… (sign up to view the full skill)More ai & agents skills
View all AI & Agents skills →New Skill Scaffolder
Create a new Claude Code skill correctly: right mechanism, valid name and folder, a triggering description, and a smoke test.
Skill Library Lint and Overlap Report
Lint every skill in a repo at once: frontmatter, name-folder match, weak descriptions, overlapping triggers, broken refs, plus a CI script.
Self-Verifying Agent Loop: Plan, Check, Retry, Close
Turns a goal into a task plan with machine-run checks, executes with retry caps, escalates, and refuses to close until verified.
Skill Test Runner (Trigger and A/B)
Test a skill in fresh sessions: ready-to-run prompts, commands, and rubric for trigger recall, false triggers, and blind A/B.