Ai Agent Multi Agent Coordination logo

Ai Agent Multi Agent Coordination

Community
peterbamuhigire
ai-agent-multi-agent-coordination

Use when designing systems where multiple agents collaborate on one task — supervisor/worker, debate, plan-execute, peer handoff. Covers handoff message contracts, shared scratchpad, conflict resolution, deadlock detection, and the cost/SLA discipline that keeps multi-agent setups from spiralling.

Overview

Publisherpeterbamuhigire
Repositorychwezi-dev-engine
Skill nameai-agent-multi-agent-coordination
Stars
29
Forks
6
Bundled files
3
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 3 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by peterbamuhigire on GitHub. Read the source before you install it.

Installation

Install the Ai Agent Multi Agent Coordination AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/peterbamuhigire/chwezi-dev-engine/tree/main/skills/ai/ai-agent-multi-agent-coordination
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/peterbamuhigire/chwezi-dev-engine.git /tmp/chwezi-dev-engine
mkdir -p .claude/skills
cp -r /tmp/chwezi-dev-engine/skills/ai/ai-agent-multi-agent-coordination .claude/skills/ai-agent-multi-agent-coordination
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Ai Agent Multi Agent Coordination in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Ai Agent Multi Agent Coordination on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Ai Agent Multi Agent Coordination is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

AI Multi-Agent Coordination

Acknowledgement: Shared by Peter Bamuhigire, techguypeter.com, +256 784 464178.

Use When

  • A single agent cannot reliably do the job (too many tools, too many domains, ambiguous routing).
  • Standing up a supervisor + workers pattern (one planner, several specialists).
  • Implementing a debate pattern where two agents propose answers and a judge picks (or a critic refines).
  • Designing plan-execute (one plan-only agent, one execute-only agent) for separation of concerns.
  • Implementing agent-to-agent handoff (sales agent hands to billing agent mid-task).

Do Not Use When

  • A single agent can do the task — use it. Multi-agent multiplies cost and latency and divides reliability. Default to single-agent.
  • The task is just multi-tool — that's not multi-agent; one agent with N tools is still one agent.
  • The task is a deterministic workflow with LLM steps — ai-agent-runtime-architecture §1 decision.

Required Inputs

  • Single-agent design first. Only escalate to multi-agent when single-agent demonstrably fails on eval.
  • Agent runtime (ai-agent-runtime-architecture).
  • Tool registry (ai-agent-tool-catalogue-and-action-gating).
  • Cost / step budgets (ai-agent-cost-and-step-budgets) — multi-agent budgets are an order of magnitude larger.

Workflow

  1. Read this SKILL.md.
  2. Justify multi-agent (§1). Reject it as default.
  3. Choose a coordination pattern (§2): supervisor/worker, debate, plan-execute, peer-handoff.
  4. Design the handoff message contract (§3). See references/handoff-protocols.md.
  5. Implement the shared scratchpad with versioning (§4).
  6. Implement conflict resolution for divergent proposals (§5). See references/conflict-resolution.md.
  7. Implement deadlock detection (§6).
  8. Apply cost discipline (§7) — multi-agent budgets are per-aggregate, with kill-switches.
  9. Apply anti-patterns (§8).

Quality Standards

  • Multi-agent justified by a written rationale + eval data comparing to single-agent.
  • A named supervisor (or named protocol) coordinates. No leaderless free-for-all.
  • Handoffs are structured messages with schemas, not natural-language guesses.
  • Shared state is versioned; concurrent writers use optimistic concurrency.
  • Conflict resolution rule is deterministic, not "another LLM call". Use voting, scoring, or human escalation.
  • Total step budget covers the aggregate, not per-agent. One agent can starve others if budgets are local.
  • Deadlock detection runs every N seconds; circular waits abort with a structured failure.
  • Multi-agent runs are traced as one task with sub-spans per agent. Replay must reconstruct the whole.
  • Cost-per-task is measured and reported; if > 3× single-agent baseline, the multi-agent design is reviewed.

Anti-Patterns

  • "Crew of agents" with no supervisor and no protocol — emergent loops, infinite back-and-forth.
  • Handoff via free-text "@billing_agent please help" parsed by regex. Fragile, non-replayable.
  • Shared scratchpad as a global mutable dict in memory — lost on worker crash, no audit.
  • "Critic" agent that just re-runs the planner with "be better". No measurable improvement, doubled cost.
  • Per-agent budgets without an aggregate cap. One agent burns its budget; supervisor spawns another; infinite spawn.
  • Multi-agent for a task the eval shows a single agent handles with > 90% success. You bought 3× cost for no quality gain.
  • Two agents writing to the same resource without idempotency / conflict detection. Race conditions become bugs that look like hallucinations.

Outputs

  • Multi-agent justification document (single-agent baseline + eval comparison).
  • Coordination pattern decision.
  • Handoff message schema per agent pair.
  • Shared scratchpad schema + concurrency model.
  • Conflict resolution rule.
  • Deadlock detector spec.
  • Aggregate cost / step budget policy.

Evidence Produced

CategoryArtifactFormatExample
CorrectnessMulti-agent topology specMarkdown + diagramdocs/ai/multi-agent-topology.md
CorrectnessHandoff protocol testsCI reporttests/ai/handoff/
Release evidenceMulti-agent vs single-agent evalMarkdowndocs/ai/eval/multi-vs-single.md
OperabilityDeadlock incident runbookMarkdowndocs/runbooks/multi-agent-deadlock.md

References

  • references/supervisor-worker.md — supervisor/worker contract.
  • references/handoff-protocols.md — agent-to-agent handoff message schemas.
  • references/conflict-resolution.md — conflict and deadlock resolution.
  • Companion: ai-agents-tools, ai-agent-runtime-architecture, ai-agent-tool-catalogue-and-action-gating, ai-agent-cost-and-step-budgets, ai-agent-observability-and-replay, ai-agent-eval, distributed-systems-patterns.

§1 Justify Multi-Agent

Multi-agent is 5-50× the cost of single-agent, 2-10× the latency, and substantially harder to evaluate and debug. Justify before adopting.

Acceptable justifications:

  • Domain partition is sharp — sales agent and billing agent need different prompts, tools, models, and personas.
  • One agent cannot fit all required tools (> 15 tools degrades selection).
  • Adversarial review (debate) measurably improves quality on the eval suite vs single-agent + critic-prompt.
  • Different agents need different model tiers (planner = flagship, worker = distilled, judge = mid).

Unacceptable:

  • "Crews are cool right now."
  • "We want it to feel like a team."
  • "Maybe we'll need it later."

The justification doc lives in docs/ai/multi-agent-justification-<feature>.md and includes the eval data.

§2 Coordination Patterns

PatternTopologyWhen
Supervisor / WorkerOne planner; N specialist workers; supervisor synthesisesMultiple domains, clear partition
Plan-ExecuteOne planner agent emits a structured plan; one executor agent runs itSeparation of concerns; planner can be a stronger model
DebateTwo agents propose; a judge picks (or a synthesiser merges)Quality-critical tasks; eval shows debate improves baseline
Peer HandoffAgents pass control via structured messages; no central supervisorConversation-style flows (sales → billing → support)

See references/supervisor-worker.md for the dominant pattern.

§3 Handoff Message Contract

Handoffs are not free-text:

json
{
  "handoff_id": "h_2026_0511_001",
  "from_agent": "sales_agent",
  "to_agent": "billing_agent",
  "task_id": 12345,
  "tenant_id": 42,
  "reason": "Customer requested an invoice for last month's hours.",
  "context_summary": "ACME, May 2026, 32 hours at $400/h, billing contact ben@acme.example.",
  "structured_state": {
    "customer_id": 88,
    "billing_period": {"start": "2026-05-01", "end": "2026-05-31"},
    "computed_hours": 32,
    "rate_usd_per_hour": 400
  },
  "expected_outcome": "Invoice created and sent.",
  "deadline_iso": "2026-05-12T10:00:00Z",
  "trust_level": "structured_only"
}

The receiving agent reads structured_state as ground truth and context_summary as advisory. The receiving agent does not trust the free-text fields to make irreversible decisions; it re-validates via its own tools.

Full protocol in references/handoff-protocols.md.

§4 Shared Scratchpad

A versioned key-value store per task:

sql
CREATE TABLE agent_scratchpad (
  task_id      BIGINT NOT NULL,
  key          VARCHAR(128) NOT NULL,
  value        JSON NOT NULL,
  version      INT NOT NULL DEFAULT 1,
  written_by   VARCHAR(64) NOT NULL,
  written_at   DATETIME NOT NULL,
  PRIMARY KEY (task_id, key)
);

Writes are optimistic-concurrency: UPDATE ... WHERE version = :expected_version. Mismatch → caller refetches and merges.

Agents read snapshots; writes go through a runtime helper that records the writing agent's identity.

§5 Conflict Resolution

Two agents propose different answers. The deterministic resolver:

python
def resolve(proposals):
    # Group by canonical answer
    groups = group_by(proposals, key=canonicalise)
    if len(groups) == 1:
        return groups[0].representative
    # Voting if odd number of judges
    if len(proposals) >= 3 and len(proposals) % 2 == 1:
        majority = max(groups, key=lambda g: len(g.members))
        if len(majority.members) > len(proposals) / 2:
            return majority.representative
    # Tie-breaker: confidence score
    return max(proposals, key=lambda p: p.confidence)

For high-stakes tasks (irreversible actions, money), conflict → human escalation, not another LLM call.

§6 Deadlock Detection

Build a wait-for graph from handoff history:

python
def detect_deadlock(task_id):
    handoffs = db.query("SELECT from_agent, to_agent FROM handoffs WHERE task_id = ?", task_id)
    g = build_directed_graph(handoffs)
    cycles = find_cycles(g)
    if cycles:
        abort_task(task_id, reason=f"deadlock_cycle: {cycles[0]}")
        page_oncall(...)

A scheduled job runs every 30 seconds. Default deadlock detection threshold: any cycle that has had ≥ 3 traversals in the last 5 minutes.

§7 Cost Discipline

Aggregate budget: task.cost_budget_usd and task.step_budget cap the sum across all agents in the task, not per-agent. A child agent's costs decrement the parent's budget.

When budget hits 80%, the supervisor's next call is annotated BUDGET_PRESSURE_80 so the supervisor can summarise and exit early.

When budget hits 100%, the task transitions BUDGET_EXCEEDED regardless of which agent is mid-step.

§8 Anti-Patterns

  • Multi-agent as default. It's an escalation, not a starting point.
  • Free-text handoff. Loses replayability.
  • Per-agent budgets without an aggregate cap. Spawn loops.
  • Critic agent that doesn't measurably improve outcomes.
  • No deadlock detection. Tasks hang for hours.
  • Shared scratchpad in process memory. Lost on crash.
  • Agents writing to the same external resource without coordination. Race conditions become "hallucinations".
  • "Agents will figure it out." They will not.

Inputs

ArtefactRequired?Purpose
Decomposable task and dependency graphyesIdentify safe parallel work
Worker scopes, permissions, and output schemasyesPrevent overlap
Reconciliation owner and conflict policyyesProduce one decision

Capability contract

Delegation is optional and runner-dependent. Workers receive minimum scope. Shared-file edits require ownership or an explicit merge strategy.

Degraded mode

Fallback without parallel workers: execute the same bounded workstreams sequentially and preserve separate evidence before synthesis.

Decision rules

Task relationshipCoordination modeFailure avoided
Independent questions or review lensesParallel workersUnnecessary latency
Output B depends on decision ASequential handoffContradictory assumptions
Overlapping file mutationsSingle owner or explicit mergeConflicting edits

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Ai Agent Multi Agent Coordination AI skill do?

Use when designing systems where multiple agents collaborate on one task — supervisor/worker, debate, plan-execute, peer handoff. Covers handoff message contracts, shared scratchpad, conflict resolution, deadlock detection, and the cost/SLA discipline that keeps multi-agent setups from spiralling.

Why use Ai Agent Multi Agent Coordination on TypingMind?

Because you install it once and use it with any model. Ai Agent Multi Agent Coordination is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Ai Agent Multi Agent Coordination in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/peterbamuhigire/chwezi-dev-engine/tree/main/skills/ai/ai-agent-multi-agent-coordination. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Ai Agent Multi Agent Coordination?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Ai Agent Multi Agent Coordination?

As many as you like. As long as a model supports skills, you can use Ai Agent Multi Agent Coordination with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Ai Agent Multi Agent Coordination AI skill free?

Yes. It is published on GitHub by peterbamuhigire under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇