Learn with Asadulelah · Lesson 1
How do I run multiple Claude Code agents in parallel without hitting the usage limit?
By Asadulelah, a Kerala-based builder of custom software and AI systems for businesses. I build by directing a fleet of AI agents, and this is how I actually do it.
WHO THIS IS FORBuilders who already use Claude Code daily and want several agents working at once (a build, research and QA in parallel) without burning the week's limit by lunch.
WHAT YOU'LL HAVE AT THE ENDA launcher pattern for headless workers, a usage gate that refuses new work past a line you choose, and briefs that survive a cap or a crash.
Run each agent as its own headless claude -p session with a written brief, start them all from one small launcher, and make that launcher check your usage meter before every start. Then stop launching at a fixed line: I stop all background work at 80% of the 5-hour window and 90% of the week, so the last slice is always left for talking to my own assistant.
The number of agents is rarely what kills your limit. What kills it is how much context each agent drags through every single turn. So the fleet rules below are half about starting agents and half about keeping each one small.
What my setup looks like
I have one lead session, my assistant Ziggy, that talks to me. When a job is big enough to split, it launches workers on my server (a 4 vCPU, 16 GB VPS) through a small Python launcher I call orchestra.py. Each worker is a normal Claude Code session running headless on my Max subscription. The launcher keeps a registry of who is running, where their log is and what they reported.
orchestra.py launch seo-learn ~/second-brain claude-opus-5-5 "$(cat brief.txt)"
orchestra.py list # who is running, who is done
orchestra.py tail seo-learn # last lines of that worker's log
orchestra.py prompt seo-learn "Continue from your state file."
Under the hood each worker is one command, with the brief piped in on stdin and the output saved as a log:
claude -p --model claude-opus-5-5 --effort xhigh \
--setting-sources project \
--output-format stream-json --verbose \
< brief.txt > runs/seo-learn.jsonl
Workers run without permission prompts, because nobody is there to click "allow". That is exactly why they only run on a server I can rebuild, and why every brief lists what they must never touch.
The steps
1. Run on the subscription, never on an API key
If ANTHROPIC_API_KEY is set in the environment, Claude Code bills that key per token instead of using your plan. A fleet on an API key is how people wake up to a bill. My launcher refuses to start a worker if the key is set, and the scripts that drive lanes unset it first. Also pass --model every time: a headless session that loads no settings can fall back to a smaller model without telling you.
2. Write the brief like a handover to a stranger
A worker knows nothing except its brief. Mine always carry five things: the goal in the user's own words, the files to read first, the hard limits, what "done" looks like, and where to write progress. One rule I add to every brief now: keep a state file, so a fresh session could pick up the work cold. The lane that built this lessons hub ran from a brief like that.
3. Gate every launch on the usage meter
My gate script reads the same usage numbers the Claude app shows (the 5-hour window and the weekly window) and caches them for 90 seconds, because the endpoint rate-limits you if you poll it hard. A hook runs it before any tool call that would start a worker or subagent, and refuses with a clear message when the line is crossed. I can override it for an hour when I really need to. A second process checks every two minutes and pauses anything that runs past the cap, then resumes it after the reset.
five_hour, weekly = meter()
if five_hour >= 80 or weekly >= 90:
refuse("Over the line. Wait for the reset or override on purpose.")
For long multi-lane jobs I use a stricter driver: a lane only starts when the 5-hour window is under 75%, the week is under 88% and at least 2 GB of RAM is free, checked every five minutes. If the week reaches 90%, the driver pauses until the weekly reset.
4. Cap the fleet by machine and by nesting
My written rule is five workers at most. I learned the ceiling the hard way: on the old 4-core server, five workers each running a frontend build froze the machine three times in one day and needed hard reboots. On the 16 GB box, about 13 workers caused out-of-memory kills. A watchdog now kills workers when load hits 8 or free memory drops under 800 MB.
The bigger lesson was nesting. One day I ran nine lanes and let every worker spawn its own subagents. They used up the whole account by mid-afternoon. Now a worker does not start other agents unless its brief explicitly says so.
5. Pick the effort level from evidence, not vibes
I tested effort levels against my own tasks. Building from a clear spec came out the same at every level, with "high" at about half the tokens of "xhigh". On planning work, "max" scored the same as "xhigh" for roughly five times the tokens. So my workers run at xhigh, chores run lower, and max is banned.
6. Make every worker resumable
Workers get killed: by the usage cap, by a reboot, by a crash. The ones that lose nothing do two things. They commit after each unit of work (one page, one fix), and they write a "RESUME FROM" line with the next undone item before they stop. One fleet that committed per page survived four limit kills and two reboots with nothing lost. The workers that saved up commits for the end lost everything.
7. Trust the process, not the status
A registry can say "done" while the process is still alive. I once resumed a worker the list called finished, and two turns ran at the same time on the same session. Now I check the process ID before resuming anything. Two smaller traps from the same month: a wait loop that used pgrep -f matched its own command line and waited an hour for nothing (wait on a PID with kill -0 instead), and background jobs started with nohup died when the worker session that started them ended.
8. Make workers report to the lead session, not to you
At first every worker posted its result straight to me. I told Ziggy: "What's the point of me seeing it?" Now workers report to the lead session, which checks the work, and I hear only what needs me. Ten agents talking to you at once is not leverage, it's a second job.
Mistakes I made
- I let a global hook in my user settings load into workers, and it hijacked a run.
--setting-sources projectkeeps workers to the project's own settings. - I let nine lanes spawn nested subagents and lost the account's day.
- I sized the fleet by worker count. The right unit is turns times context: one worker with an 800k context costs more than five small ones.
- I trusted "done" in a list instead of checking the process.
What I'd do next
If you are starting today: run two workers, not ten. One launcher script, one meter check before each start, one state file per worker. Add the watchdog and the pause-and-resume guard the first time you hit the cap, not before. For me, the next step is counting usage per lane, so I can see which kind of job actually eats the week.
Keep learning
- Why does Claude Code use up my usage limit so fast?
- How do I make Claude Code remember context between sessions?
- Answer: How can a business owner check whether software built with AI is actually solid?
- The AI builder's glossary (25 terms in plain words)
All lessons · All answers · About Asadulelah
Want a system like this built for your business? Book a 30-minute call or email hello@asadulelah.com.