Fleet Telemetry for Parallel Coding Agents: Find the Stampede, the Hotspot and the Runaway That Per-Agent Alerts Miss
Twelve coding agents, 94 events, zero per-agent alerts, and the change is stuck. Group the same events across the fleet and three failures appear: 10 of 12 agents rate limited in one minute, six agents on service.py with five conflicts, and one agent that ran pytest 36 times and holds 56% of the tokens.
What you will learn
- Explain why a fleet of healthy-looking agents can still fail
- Roll up telemetry per agent, then across the fleet by minute, by file and by share
- Detect a rate-limit stampede, a file hotspot and a runaway agent
- Pick the fleet-level fix for each failure mode
Before you start
- Running several Claude Code agents in parallel
- Basic Python
Picture an on-call engineer. Twelve coding agents are working in parallel on one SupportDesk change: add an urgency field to tickets. Each agent has its own worktree and owns one file.
Every agent looks healthy. And still, the change is stuck.
In this article we read the fleet two ways from the same events: one row per agent, and one row for the whole fleet. The second view finds three failures the first one can't see: a stampede, a hotspot and a runaway. A fleet can fail while every single agent looks fine.
A fleet of delivery vans
- All the vans leave at once and take the same street. The street jams. That is a stampede.
- Six vans need the same loading dock. They queue up. That is a hotspot.
- One van circles the block again and again. The fuel is gone and nothing is delivered. That is a runaway.
Every van's own gauge looks fine. The map shows the problem.
Where the events come from
Real fleet telemetry comes from OpenTelemetry: Claude Code can export token usage and API error events, with a session id on each, so you can group by agent (for tracing an agent loop with OpenTelemetry, see this article). In this project, events.py stands in for that: 94 made-up events from 12 agents. Nothing calls a model, so no API key is needed. Each event has five fields:
@dataclass
class Event:
agent: str
minute: int
kind: str # tool_call, edit, api_429, conflict
target: str
tokens: int
rollup.py: the per-agent view
"""The per-agent view: what a dashboard shows for each agent on its own."""
from collections import Counter, defaultdict
ALERT_429, ALERT_TOKENS, ALERT_CONFLICTS = 5, 150_000, 2 # the usual per-agent limits
def per_agent(events):
stats = defaultdict(Counter)
for e in events:
stats[e.agent]["tokens"] += e.tokens
stats[e.agent][e.kind] += 1
return stats
def agent_alerts(stats):
"""An alert only when one agent crosses its own limit."""
return [a for a, s in stats.items()
if s["api_429"] > ALERT_429 or s["tokens"] > ALERT_TOKENS or s["conflict"] > ALERT_CONFLICTS]
The limits are the usual ones, each checked for one agent at a time. Total the tokens, count the events per agent, and alert only when one agent crosses its own line.
Run it over the 94 events: twelve green tiles, zero alerts. The most rate limits (HTTP 429) on any one agent is two, far below the limit of five. Every agent passes. The fleet does not.
detectors.py: the fleet view
"""The fleet view: look across agents, by minute, by file and by share of the fleet."""
from collections import Counter, defaultdict
from statistics import median
from rollup import per_agent
def stampede(events, n_agents):
"""Rate limits are shared by the whole organization: many agents limited in the same minute."""
by_minute = defaultdict(set)
for e in events:
if e.kind == "api_429":
by_minute[e.minute].add(e.agent)
minute, who = max(by_minute.items(), key=lambda kv: len(kv[1]))
return (minute, len(who)) if len(who) * 3 >= n_agents else None
def hotspot(events, min_agents=3):
"""One file edited by several agents at once: the merge conflicts wait there."""
editors = defaultdict(set)
for e in events:
if e.kind == "edit":
editors[e.target].add(e.agent)
conflicts = Counter(e.target for e in events if e.kind == "conflict")
file, who = max(editors.items(), key=lambda kv: len(kv[1]))
return (file, len(who), conflicts[file]) if len(who) >= min_agents else None
def runaway(events, min_repeats=10, min_share=0.25):
"""One agent repeating the same call and holding a big share of the fleet's tokens."""
stats = per_agent(events)
total = sum(s["tokens"] for s in stats.values())
repeats = Counter((e.agent, e.target) for e in events if e.kind == "tool_call")
(agent, call), n = repeats.most_common(1)[0]
share = stats[agent]["tokens"] / total
return (agent, call, n, share) if n >= min_repeats and share >= min_share else None
(Excerpt; the file also has typical_tokens, the median tokens of the other agents.)
- Stampede groups the 429 errors by minute, across all agents. If a third of the fleet is limited in one minute, it is a stampede. Rate limits apply to the whole organization, so agents that start together share one budget.
- Hotspot asks which agents touched each file, and counts the conflicts waiting on it.
- Runaway counts the repeated calls per agent and keeps the most repeated one, then works out that agent's share of the fleet's tokens. It alerts only when the repeats and the share are both high.
Same events, two views
run_all.py reads the telemetry per agent, then across the fleet:
fleet: 12 agents | 94 events | 220,200 tokens
per-agent view: 0 alerts | most 429s on one agent: 2
stampede: minute 2 | 10 of 12 agents rate limited
hotspot: service.py edited by 6 agents | 5 conflicts
runaway: A09 ran 'pytest tests/' 36 times | 56% of fleet tokens (a typical agent: 10,000)
- The stampede is minute 2: ten of twelve agents were limited in that same minute. All of them launched at once. The two that missed the burst had started a little later.
- The hotspot is
service.py. Nobody owned it, but six agents edited it, and five merge conflicts are waiting there. Only the first edit merged cleanly. - The runaway is A09. It ran the same test command 36 times and holds 56% of the fleet's tokens, where a typical agent used 10,000.
Three failures, none visible in one agent. Why didn't the per-agent alert catch A09? Its total stayed under the 150,000-token line. The problem is not the absolute size, it is the share and the repeats.
Each mode gets a fleet-level fix
| Failure | What you see across the fleet | Fleet-level fix |
|---|---|---|
| Stampede | Many agents limited in one minute | Stagger the launches and share one retry budget. Start bulk jobs at a low rate and spread the requests evenly. |
| Hotspot | Many agents on one file | Split the task again so one agent owns each file. |
| Runaway | One agent with a big share and repeated calls | Give each agent a budget and stop on repeated calls. |
Retrying a single agent fixes none of the three.
Common mistakes
- Tightening each agent's alert limits. Still one agent at a time. The problem lives between agents.
- Adding more agents to finish sooner. More agents launching together make the stampede and the hotspot worse.
- Retrying each stuck agent on its own. The loop and the conflict queue stay where they are.
- Leaving the session id off the events. Without it you can't group by agent, and no fleet view is possible.
Quick recap
| Idea | Group by | In this run |
|---|---|---|
| Per-agent rollup | agent | 0 alerts |
| Stampede | minute, across agents | minute 2, 10 of 12 |
| Hotspot | file, across agents | service.py, 6 agents, 5 conflicts |
| Runaway | share of fleet tokens + repeats | A09, 36 repeats, 56% |
Try it yourself
In events.py, move half the agents' launch to minute 3 so the 429 burst splits across two minutes. Predict what stampede returns now with its one-third rule, then run it. Is a stampede that is spread over two minutes still a problem your rate limit will feel?
Related course on Udemy
Claude Certified Developer - Professional (CCDV-P) Exam Prep
Claude agents in production: reliability, observability, evals, cost, guardrails and fleets.View on Udemy ↗: Claude Certified Developer - Professional (CCDV-P) Exam Prep (paid course, opens in a new tab)Related posts
CLAUDE.md, settings.json and Plugins: Which Claude Code File Advises, Which Enforces, Which Packages
Three needs in one repo: a test command, a rule that Claude must never read .env, and a shared deploy skill. See which file each belongs in, how the settings layers merge, and what a plugin manifest carries.
Authoring a Claude Skill: SKILL.md, Frontmatter, Progressive Disclosure and the Description That Triggers It
Pack a support team's ticket-triage routine into one skill folder, then watch three requests load one, two or all three levels: the catalog, the SKILL.md body, and a script whose code never enters the context.
One Change, Four Environments: Where a Claude Config Edit Lands in Dev, Staging, Prod and CI
Change one line in a repo and ask where it lands. A small resolver for bookshop-bot shows that a new model id in settings.json reaches only CI, a prompt bump reaches dev and CI, and a prod block edit reaches only prod.
Claude in the SDLC: Prompts in Git, a Change Gate by Path, a Claude Review That Advises and a Person Who Merges
Follow one prompt edit from a branch to a merge: version prompts and the model pin like code, keep the API key in GitHub Secrets, gate changes by path, let Claude review the diff, and leave the merge to a person.
