Skip to content
Amila

Palahepitiya Gamage Amila · Weekly Learnings

Running AI agents in parallel: when my PC ran out

· Palahepitiya Gamage Amila

Step chart of how many AI agents ran at once from mid-October to 1 November: 2, then 5 on 16 Oct, 6 on 20 Oct, down to 4 on 23 Oct out of memory, back to 6, then down to 4 again on 29 Oct out of memory.

On the morning of 23 October I typed a short message into my own agent setup: "My machine is out of memory." Then I told it to run fewer agents at once. Six went down to four.

That was the first time. The second time, a week later, was worse.

The short answer. When you run multiple AI agents in parallel on one machine, memory runs out before the agents do. On my 64GB PC, six coding agents working side by side ran it out of memory twice in a week, and tests started failing only because the machine was busy. The fix that helped most was a free-memory floor: no new agent starts unless enough memory is free.

Some context. I work as a fractional CTO, and since late September I've been building a setup where several AI agents work on the same project at the same time. The project is for a client who is rebuilding an older business system. A plan gets split into pieces, each agent takes one piece, and the pieces get merged back together and tested.

Between 25 September and 1 November I made 27 improvements to that setup. Almost every one came from something breaking. Looking back, they fall into a few stages.

Stage 1: Can you trust what your agents tell you?

The first weeks were about trust. Could I believe what the setup told me?

It could pick up an old handoff note from an earlier step and treat it as fresh work. The spending meter missed some of the agents, so the totals looked lower than they were. On 12 October one build raised four stall alarms that weren't real stalls.

So I fixed the boring parts first. Handoffs now only count if they were written after the step started. Every agent's spend gets counted. The safety checks that used to live only in the docs are now enforced in code.

Stage 2: How do you run multiple AI agents in parallel?

Mid-October was when agents started working in parallel. The default was two at once.

The first live run, on 17 October, didn't go well. The agents read their handoffs from the wrong place and sat stuck for an hour before anything noticed. One agent locking a file killed another one.

After those fixes I pushed the number up:

  • Two agents at once by default.
  • Five from 16 October.
  • Six from 20 October.

Around the same time I changed how work gets handed out. A piece now starts as soon as the pieces it depends on are merged, instead of waiting for a whole batch. Before, one agent hitting a problem could kill all the others. Now it turns into a question for me.

Stage 3: Why do AI agents run out of memory?

Between 17 and 20 October the setup hit nine separate faults. In one, the main process was stopped for "critically low system memory" and both agents under it died with it. The memory reaper killed the whole loop twice.

The fix was a rule: don't start a new agent unless there's enough free memory. I set that floor at 4GB, and heavy pieces count as two agents. Agents also now survive if the main process stops, and they get picked back up when it resumes.

There was a phone problem too. A test device froze, and my notes put the cost at "about eight agent-hours". UI checks were taking one to four hours each, so I added time limits and kept test devices warm between runs.

Step chart of how many AI agents ran at once from mid-October to 1 November: 2, then 5 on 16 Oct, 6 on 20 Oct, down to 4 on 23 Oct out of memory, back to 6, then down to 4 again on 29 Oct out of memory.

Stage 4: What happens when the computer becomes the limit?

On 23 October the memory ran out anyway. I cut agents from six to four, then raised it back to six by that night once things settled.

On 29 October it happened again, and this time the work itself suffered:

  • Eight pieces were active at once, and the PC was overloaded.
  • Database setup ran about ten times slower than normal.
  • Pages in my end-to-end tests gave up after three minutes of loading.
  • Each failure cost a fix round, even though no code was wrong.

That last point is what got me. The agents were spending time fixing problems that were really just a busy machine.

I kept tightening the setup anyway. One fix on 28 October targeted CPU use while a batch of agents sat paused:

  • Before: 84% of one CPU core.
  • After: about 7%.
  • Measured on a test copy, not a live run.

By 1 November free memory was down to about 2GB, so I raised the floor from 4GB to 6GB and later that afternoon moved back up to five agents.

Is a Mac mini better for AI agents?

My PC has 64GB of memory and a 13th gen Intel i7. Two months ago that felt like plenty. With six agents, each building and testing its own piece, it isn't.

So I bought a Mac mini with an M5 Pro chip:

  • 18-core CPU and 20-core GPU.
  • 64GB of unified memory.
  • 1TB SSD.
  • 10Gb Ethernet and three Thunderbolt 5 ports.

I start trying it on 5 November. I don't know yet how many agents it will hold. I'll write about that once I have real numbers, not guesses.

What I can say now is that the setup itself is steadier than it was in September. Most of that came from fixing what broke, one fault at a time.

If you run AI agents in parallel on one machine, set a minimum amount of free memory and don't let a new agent start below it. Start with something like 4GB, watch what happens, and raise it if your tests start failing for no clear reason.

Questions this note answers

How many AI agents can you run in parallel on a 64GB PC?

In my setup, six was the normal number. Twice I had to cut it to four when memory ran out, and on 1 November free memory was down to about 2GB with four running.

How much free memory should you keep when running AI agents?

I started with a floor of 4GB and raised it to 6GB on 1 November. No new agent starts below it, and heavy pieces count as two agents.

What are the signs your machine is too small for your agents?

Jobs slow down and tests fail with no code fault. On 29 October database setup ran about ten times slower than normal, and test pages gave up after three minutes.

Is a Mac mini good for running AI agents?

I don't know yet. I bought a Mac mini M5 Pro with 64GB of unified memory and start trying it on 5 November. I'll share real numbers once I have them.