Limits and policy controls for a team's coding agents: which control stops what
When a team lets coding agents run on their own cloud machines, the first worry is usually not what the agents can do. It is what happens when one of them does too much of it: a retry loop, a task that fans out into thir
When a team lets coding agents run on their own cloud machines, the first worry is usually not what the agents can do. It is what happens when one of them does too much of it: a retry loop, a task that fans out into thirty machines, a command that should have waited for a person.
"Rate limit" is the word people reach for, but it is only one of several controls, and they sit in different places and are set by different people. This post is about the controls on the team side: the limits and policies that apply to Claude Code, Codex or Cursor running on your team's machines, not limits you build inside a product you ship. For each control: what it catches, who sets it, and what the agent sees when it hits it. The Sandscale details come from the API limits docs, the plans reference, the approvals and policies page and the CLI (1.4.1).
The controls on one page
| Problem | Control | Who sets it | The agent sees |
|---|---|---|---|
| Too many machines at once, or too big a machine | Plan quotas: boxes at once, vCPU per box | The plan |
quota_exceeded, before anything starts |
| Calling the API too fast | API rate limits | Sandscale |
429 with Retry-After, code rate_limited
|
| One app or person hammering the MCP server | Per-app and per-person MCP limits | Sandscale | The call is refused |
| A loop that burns hours | Spend caps (task, agent, project, organization) | Your administrators | Depends on the cap you set; try it before you rely on it |
| A machine that never stops | Idle timeout and time to live | Your administrators and the machine's owner | The machine stops |
| An action that should not happen unasked | Policy and approval gates | Your administrators and approvers | The call waits for a person, or is refused |
| Everything must stop now | Kill switch | Your administrators | Nothing new starts; running work stops |
Two things are not on the list. Model tokens are not seen by Sandscale, so token budgets belong in your model gateway or in the agent's own settings. And the limits that Claude Code, Codex or Cursor apply on their own side are separate from everything above.
Plan quotas: the ceiling on machines
Your plan sets how many boxes may run at once and how many vCPUs each may have. The plans reference lists them: for example 3 boxes at once on Free and 30 on Pro and Team. A request that would go over a quota is refused before anything starts, with quota_exceeded.
For a team, this is the control that decides how many agents can work at the same time. If you have thirty engineers and each wants two agents running, the arithmetic does not fit in thirty boxes, and finding out on a Monday morning is worse than finding out in planning. Our post on queueing agent runs against a concurrency cap covers what to do when the cap is the constraint.
Rate limits: how fast an agent can call
Endpoints are rate limited. Over the limit, the API answers 429 with a Retry-After header in seconds and the code rate_limited. Some endpoints with a cost, such as starting sandboxes, have their own lower limits. The docs' rules for a client are worth giving to an agent verbatim:
- Retry
429afterRetry-After. Retry502,503and504with exponential backoff and jitter. - Do not retry
400,401,403,404,409,410or422unchanged. They will answer the same. - A
POSTthat creates something is not always safe to repeat. After a timeout, list what exists before creating it again.
The last rule matters for agents: a retry after a timeout can start a second machine. In the CLI (1.4.1), exit code 7 is "rate limited", worth retrying after a pause, and exit codes 4 (refused) and 8 (plan or usage limit) are for a person: retrying will not help.
Sandscale's remote MCP server has its own limits: per the docs, each connected app can make up to 120 calls a minute and each person up to 60, so a looping agent hits a limit before it hits anything expensive.
Spend caps: the ceiling on hours
A rate limit protects the API. It does not protect the plan's hours, because a single long-running machine uses hours at a steady, perfectly polite rate. A running box counts toward the plan's hours whether it is busy or idle. Spend caps, available on Pro, Team and Enterprise, put a ceiling on spending per task, per agent, per project and per organization. Our post on spend caps explains which level catches which problem.
Time limits on the machine itself are the cheaper first line. A workspace stops when it has been idle, and a time to live puts a ceiling on a run:
sandscale workspace update --ws-id WORKSPACE_ID --idle-timeout-seconds 1800 --ttl-seconds 28800 --yes
The idle timeout is at least 300 seconds and within your organization's maximum. A time to live of eight hours means a forgotten agent costs eight hours, not a month.
Policy and approvals: what an agent may do
Rate limits and caps do not look at what a call does. Policy does. On Sandscale, policies set which templates, sizes and run times members may use and which agents may run, and an approval gate makes a person sign off before something happens. Approvals come with every plan, and nobody approves their own request.
For Claude Code, the agent policy goes further: it runs under your policy through its hooks, so each prompt is checked, and each tool call is allowed, blocked or sent to a person. For Codex and Gemini CLI, the policy page says every step is reported, which makes it a record rather than a gate. Be clear about that difference when you decide which agents get which tasks. Prompts and tool calls are also checked for credentials by DLP, on every plan.
Where to start is a short list. Our post on writing a policy for coding agents offers three lists (allowed, needs a person, never), and human approvals for agent tool calls covers how to avoid approval fatigue. A good first approval rule is the one you would be embarrassed to learn the agent had done unasked: pushing to a shared branch, using a production credential, leasing a large machine.
The kill switch: when none of the above is enough
Every organization has a kill switch that stops its agents at once. It is for the incident, not for tuning, so rehearse it once while nothing is wrong. Our post on the kill switch covers what it should stop and who should hold it. Everything the controls above do, and every approval and kill switch use, is in the audit log.
What to tell the agent
Controls that refuse should be explained to the agent, or it will retry into them. A section for AGENTS.md:
## Limits
- If a command is refused or a tool call waits for approval, stop and say so in
your summary. Do not retry it, rephrase it, or look for another way around it.
- If you get a rate limit (429, or CLI exit code 7), wait as long as the response says,
then retry once. If it happens again, stop and report.
- If a quota or plan limit is hit (quota_exceeded, CLI exit code 8), stop and report.
- Before starting a machine, run `sandscale workspace list` and reuse one you own.
- Stop machines you started when your task is done.
Like every instruction file, this is a request. The controls above are what enforce it.
A short order of operations for a new team
- Set an idle timeout and a time to live on every workspace.
- Write down the three or four actions that need a person, and turn on approvals for them.
- Check your plan's boxes-at-once against how many agents you expect to run.
- Add spend caps at the project level if your plan has them.
- Rehearse the kill switch once.
None of this needs custom code. Most of it is a conversation among the people who will be woken up if it goes wrong.
Originally published on the Sandscale blog.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.