After an OpenClaw upgrade, a small host serving many busy chats hits provider rate limits and memory pressure; which limit governs concurrent agent runs, and how do you cap it?
answer
- one run per session, many sessions
- global main lane
- agents.defaults.maxConcurrent
- CPU-derived default since 2026.9.5
- sub-agent and cron lanes separate
basics
~20 sInbound runs share the global main lane, capped by agents.defaults.maxConcurrent. Since OpenClaw 2026.9.5 the unset default is four runs per available CPU, at least eight, so a constrained host should set an explicit lower value.
solid answer
~40 sEvery inbound run waits first on its session lane, which keeps one run per session, and then on the global `main` lane, whose size is `agents.defaults.maxConcurrent`. Since release 2026.9.5, leaving it unset gives `max(8, available CPU parallelism * 4)`: 32 concurrent runs on an 8-CPU host. The release notes warn this uses more memory and puts more pressure on providers, so an upgraded install that never pinned the value can suddenly run many more model calls at once. Setting an explicit value such as `4` caps it; extra runs wait in FIFO order while typing indicators still fire. The cap does not cover sub-agents (`agents.defaults.subagents.maxConcurrent`, default 8 per spawning session), Swarm collectors or the cron and heartbeat lanes, which have their own budgets.
code
json · 8 lines{
"agents": {
"defaults": {
"maxConcurrent": 4,
"subagents": { "maxConcurrent": 2 }
}
}
}go deeper
Know that one chat always runs one turn at a time, while different chats can run in parallel up to a Gateway-wide limit.
Explain the session lane against the main lane, name agents.defaults.maxConcurrent and its CPU-derived default, and list the lanes it does not cover.
Tie rate limiting and memory growth after an upgrade to the 2026.9.5 default change, pin an explicit cap, and confirm the effect with queued-for log lines and lane diagnostics.
Set concurrency from provider quotas, memory and local-model capacity rather than CPU count, and decide which defaults the install pins so releases cannot silently change its cost.
## Two layers of serialization OpenClaw runs every inbound auto-reply through a lane-aware FIFO queue inside the Gateway. Two different limits apply to each run, and confusing them is the usual mistake: - **The session lane** (`session:<key>`) guarantees that only one agent run touches a given session at a time. No setting raises this: one chat is always answered one turn at a time, and mid-run messages follow the queue mode. - **The global `main` lane** caps how many inbound runs, across all sessions, execute at once. Its size is `agents.defaults.maxConcurrent`. A run first waits on its session lane, then on the main lane. On a quiet personal install neither wait is noticeable. On a host serving many busy chats, the main lane decides how many model calls and tool processes run in parallel. ## The default changed in 2026.9.5 Before release 2026.9.5, an install that never set `agents.defaults.maxConcurrent` got a lower default. Since 2026.9.5 the default is derived from the machine: - `max(8, available CPU parallelism * 4)`, using `os.availableParallelism()` with `os.cpus().length` as a fallback; - that is 32 concurrent runs on an 8-CPU host and 192 on a 48-CPU host; - an explicit value still takes precedence, including after upgrades. The release notes warn that more simultaneous turns can use more memory and put more pressure on providers. So an install that relied on the old default can, after upgrading, start many more model calls at once, which shows up as provider rate limiting, retry indicators and memory growth on a small machine. ## Capping it Set an explicit limit in `openclaw.json`: ```json { "agents": { "defaults": { "maxConcurrent": 4 } } } ``` What changes and what does not: 1. At most four inbound runs execute at once; further runs wait on the main lane in FIFO order. 2. Each session still runs one turn at a time; the limit never lets one chat answer two messages in parallel. 3. Typing indicators still fire immediately on enqueue on channels that support them, so users see activity while their run waits. 4. With verbose logging, a run that waited more than about two seconds logs a short `queued for ...ms` notice. ## Lanes that the main cap does not cover | Work | Lane and limit | | --- | --- | | Sub-agent runs | `subagent:<immediate session>`, `agents.defaults.subagents.maxConcurrent`, default 8 per spawning session | | Swarm collector children | per group, `tools.swarm.maxConcurrent`, default 32 | | Isolated cron agent turns | a `cron` slot, with inner execution on `cron-nested` | | Heartbeat embedded runs | the bounded `cron-nested` lane for global admission | | Skill Workshop reviews and plugin background work | a built-in shared budget of three concurrent runs | So lowering `agents.defaults.maxConcurrent` does not, by itself, bound sub-agent fan-out or scheduled jobs; each has its own budget. Background lanes exist precisely so slow scheduled work does not block inbound replies. ## Telling waiting from stuck - A queue that is draining shows `queued for ...ms` lines in verbose logs. - The Control UI **System busyness** overlay and `diagnostics.lanes` report active and queued work per lane. - With diagnostics enabled, sessions processing past a two-minute warning threshold with no observed progress are classified as `session.long_running`, `session.stalled` or `session.stuck`, and recovery can release a lane held by stale work. ## Common mistakes - **Raising the cap to fix one slow chat.** A single session never runs two turns at once, so a bigger main lane does nothing for it; look at its queue mode and the run itself. - **Pinning nothing.** Leaving the value unset means the next release that changes the default changes the install's load too, as 2026.9.5 did. - **Forgetting the other budgets.** A cap of four inbound runs can still sit beside up to eight sub-agent runs per spawning session, Swarm groups and scheduled work. ## Picking a number There is no single right value. Size the main lane to the provider's rate limits and the host's memory rather than its CPU count: a small VPS whose runs mostly wait on a cloud model may be fine at a handful, while local models are bounded by the GPU long before the CPU-derived default. Then cap sub-agents separately if the agents spawn them.
- Does raising `agents.defaults.maxConcurrent` let one OpenClaw chat answer two messages at the same time?No. The session lane guarantees that only one agent run touches a session at a time, whatever the main-lane cap is. A message that arrives while that chat's run is active is handled by the queue mode: steered into the running turn by default, or queued as a followup or collect turn. `maxConcurrent` only controls how many different sessions run in parallel.
- How can you tell whether OpenClaw runs are waiting on the lane or genuinely stuck?With verbose logging, a run that waited more than about two seconds logs a `queued for ...ms` notice, which shows the queue is draining. The Control UI System busyness overlay and `diagnostics.lanes` show active and queued counts per lane. With diagnostics enabled, sessions without progress past the warning threshold are classified as `session.long_running`, `session.stalled` or `session.stuck`, and recovery can release a lane held by stale work.
- agents.defaults.maxConcurrent limits how many messages one chat can process in parallel.
- The main lane runs only one agent run at a time across the whole Gateway by default.
- Lowering maxConcurrent also caps sub-agent, Swarm and cron runs.
- An unset maxConcurrent keeps whatever value it had when OpenClaw was installed.
- More CPUs always make a higher concurrency cap safe for the model provider.
Assumes OpenClaw 2026.9.9; the CPU-derived main-lane default of four runs per CPU, minimum eight, arrived in 2026.9.5.