Technology Apr 15, 2026 · 3 min read

Let Your Claude Code Agents Talk to Each Other: Introducing agent-dispatch πŸ€–β†”οΈπŸ€–

Let Your Claude Code Agents Talk to Each Other: Introducing agent-dispatch πŸ€–β†”οΈπŸ€– TL;DR: An MCP server that lets Claude Code agents delegate tasks to specialized agents in other project directories. No more context-copying or permission sprawl. GitHub | PyPI The Problem: Ag...

DE
DEV Community
by Serik Ospanov
Let Your Claude Code Agents Talk to Each Other: Introducing agent-dispatch πŸ€–β†”οΈπŸ€–

Let Your Claude Code Agents Talk to Each Other: Introducing agent-dispatch πŸ€–β†”οΈπŸ€–

TL;DR: An MCP server that lets Claude Code agents delegate tasks to specialized agents in other project directories. No more context-copying or permission sprawl. GitHub | PyPI

The Problem: Agents Live in Silos 🏝️

Working with Claude Code is fantastic until you need to cross project boundaries. If I'm debugging backend/ but need to check infra/ logs or query a staging DB, I'm forced to:

  1. Copy-paste context β†’ fragile, loses project-specific config.
  2. Give one agent access to everything β†’ security risk, prompt bloat.
  3. Switch terminals manually β†’ breaks flow, defeats the AI assistant.

I wanted specialized agents that collaborate without sharing credentials, configs, or context pollution. So I built agent-dispatch.

What Is It? πŸš€

agent-dispatch is an MCP server that turns each project directory into an isolated, callable agent. When you dispatch a task, it spawns a fresh claude -p session in that directory, inherits its local CLAUDE.md, .mcp.json, and tools, executes the task, and returns a structured result.

Think of it as microservices for AI workflows: composable, cached, and sandboxed.

Quick Start (30s)

pip install agent-dispatch
agent-dispatch init
agent-dispatch add infra ~/projects/infra
agent-dispatch test infra "List running Docker containers"

That’s it. Now every Claude session can dispatch tasks to your infra agent.

How It Works πŸ”§

Your Claude session (e.g., backend/)
  β”‚
  β”œβ”€ dispatch("infra", "find scheduler errors", caller="backend")
  β”‚
  β–Ό
agent-dispatch MCP server
  β”œβ”€ βœ… Cache check β†’ hit? return instantly
  β”œβ”€ πŸ”’ Safety check (depth, budget, concurrency)
  └─ πŸš€ subprocess.run("claude -p ...", cwd=~/projects/infra/)
       β”‚
       β–Ό
     Fresh Claude session in infra/
       β”œβ”€ Loads infra's CLAUDE.md, .mcp.json, tools
       β”œβ”€ Receives structured prompt: goal + caller + context + task
       └─ Executes β†’ returns result β†’ cached for next time

The Toolkit 🧰

Tool Use Case
dispatch One-shot task. Cached by default.
dispatch_session Multi-turn conversation with context retention.
dispatch_parallel Fan-out to multiple agents simultaneously.
dispatch_stream Live token streaming for long tasks.
dispatch_dialogue Two agents collaborate until [RESOLVED].

Example call:

{
  "agent": "db",
  "task": "Are all migrations applied?",
  "caller": "backend",
  "goal": "Debug startup failure"
}

Safety & Cost Control πŸ›‘οΈ

I didn't want a demo toyβ€”I wanted production-ready tooling. Built-in safeguards:

  • Recursion protection: max_dispatch_depth (default: 3)
  • Cost limits: max_budget_usd per agent or globally
  • Concurrency caps: max_concurrency limits parallel claude -p processes
  • Timeouts: kills stuck sessions (default: 300s)
  • Caching: identical (agent, task, context) requests return instantly. Only successes cached.
  • Hot-reload config: add/remove agents via ~/.config/agent-dispatch/agents.yaml without restarting.

When to Use (and When Not To) βš–οΈ

βœ… Do dispatch when:

  • The task needs tools, files, or context from another project
  • You want to leverage project-specific MCP servers or CLAUDE.md
  • You need parallel answers from multiple codebases

❌ Don't dispatch when:

  • The task is simple and local (just use your current agent)
  • You need sub-second latency
  • You're in a tight loop (use dispatch_parallel instead)

Try It & Let Me Know! πŸ’¬

πŸ”— GitHub

πŸ“¦ PyPI

pip install agent-dispatch
agent-dispatch init
agent-dispatch add my-agent ~/path/to/project

I'd love your feedback:

  • What agent collaboration patterns would you use this for?
  • What safety features are missing?
  • Would you prefer a different abstraction (e.g., HTTP API vs MCP)?

Drop a comment below or open an issue. This is very much a "build in public" project. πŸ™

DE
Source

This article was originally published by DEV Community and written by Serik Ospanov.

Read original article on DEV Community
Back to Discover

Reading List