The Problem
Withscale = 1, a single agent instance handles all work sequentially. If 5 GitHub issues arrive via webhook while the agent is working on one, those 5 events queue up and wait. For high-volume workloads, this creates a bottleneck.
Increase Scale
In the agent’sconfig.toml:
Add Locking
With multiple instances, two agents might try to work on the same issue. Add a lock/skip/work/unlock pattern to yourSKILL.md:
How lock commands work
When the agent runsrlock "github://owner/repo/issues/123":
- Lock acquired:
{"ok": true}— proceed with work - Already held:
{"ok": false, "holder": "dev-abc123", ...}— skip this resource
runlock "github://owner/repo/issues/123" releases the lock.
If the agent crashes or times out, locks are auto-released.
Monitor with al stat
Check queue depth and running instances:
queue column shows how many events are waiting. If it’s consistently high, consider increasing scale.
Resource Considerations
Each parallel instance:- Uses a separate Docker container
- Consumes memory (
local.memoryper container, default 4GB) - Consumes CPU (
local.cpusper container, default 2) - Makes independent LLM API calls (watch your rate limits and quota)
Tune work queue size
If events arrive faster than agents can process them, the queue buffers them:Default agent scale
Set the default scale for all agents that don’t have an explicitscale in their config.toml:
Project-wide scale cap
Limit total concurrent runners across all agents:defaultAgentScale * agentCount exceeds scale, agents are throttled at startup and a warning is shown.
Example Configuration
Agent runtime config inagents/dev/config.toml:
Next steps
- Resource Locks (concepts) — TTL, heartbeat, deadlock detection
- Agent Commands — Locks — full command syntax and responses