Allocating Resources When Running Several AI Agents at Once
How to think about putting several AI agents with different roles on a single VPS, and how to separate them so that one running out of control doesn't drag the others down.

Ren
Procura
What competing for resources means
- Several agents share the same CPU and memory
- While one is doing heavy processing, the other may respond more slowly
- If one behaves abnormally, it can affect the other's operation too

Ren

Procura
Separating them while keeping them together
With container technology, you can set separate resource limits for each agent even within a single VPS. Even if one runs out of control unexpectedly and tries to use up all the memory, it can only use up to its allotted limit, so the other keeps running unaffected. If you're going to put them together, design this separation in from the start.
- Put each agent in its own container and set limits on the resources it can use
- Give a more generous limit to the more important one
- Even if one goes down, keep the others running
Separate the places logs go too
Besides resources, separating where records go also helps when trouble occurs. If you put the logs of several agents into one file, then when you want to investigate abnormal behavior in one, the other's records get in the way and make it hard to read. If you keep records separate for each agent, isolating the cause goes that much faster.
- Use a separate log destination for each agent
- Make it clear from the file name which agent a record belongs to
- Also prepare a common notification destination that picks up only serious abnormalities together

Procura

Ren
Procura
The startup order matters more than you'd think
In a setup where several agents start at the same time, one may need to wait for the other to be ready before it starts running. If you configure everything to start at once without thinking about this order, it can lead to hard-to-understand problems, like errors that appear only right after startup. If there are dependencies, prepare both the startup order and a mechanism that waits until the other side is ready.
- Sort out in advance whether the agents depend on each other
- Add a mechanism that waits until what they depend on is ready before starting
- If an error appears only right after startup, suspect an ordering problem

Ren
This article is translated from the Japanese original. If the two differ, the Japanese version is the one we keep up to date.