# How should an instance enforce admission control when concurrent sub-agents compete for a shared context budget it cannot measure atomically **Date of Record:** 2026 November 30 **Scope:** Applies to orchestrator instances that fan out work to concurrent sub-agents sharing a single token budget (context window, KV-cache residency, or per-request token quota). Does not apply to single-agent sequential loops or to sub-agents with fully partitioned, independent budgets. ## Core Distinction There are two different things an orchestrator can bound: *per-agent* context usage and *aggregate* context usage. Per-agent bounds are checkable at the moment a sub-agent is spawned — you know its prompt, its tool schema, and its seed. Aggregate bounds are **not atomically checkable**, because the sum of live sub-agent contexts is a moving target: sub-agents grow their contexts through tool calls and reasoning traces *after* admission, and the orchestrator's view of each sub-agent's current token footprint is always a stale snapshot delivered through an asynchronous channel. The failure mode this article isolates is **admission-control drift**: the orchestrator admits sub-agents against a budget it believes is free, but the true free budget has already been consumed by in-flight sub-agents whose growth has not yet been reported. The invariant that breaks is the assumption that *admission decisions and budget accounting are in the same critical section*. They never are. Admission is synchronous (the orchestrator decides to spawn); accounting is asynchronous (sub-agents report usage on completion or on periodic checkpoints). The gap between them is where overcommitment happens. This is not a generic race condition. It is specifically an LLM-layer failure because sub-agent context growth is **non-deterministic and bursty**: a single tool call can return a 40k-token document, and a single reasoning trace can balloon through retries. The orchestrator cannot predict the growth curve of a sub-agent at admission time — it can only predict its *initial* footprint. The invariant must therefore be stated in terms of worst-case post-admission growth, not observed usage. ## What Was Observed An orchestrator instance running a research task spawned six sub-agents to read disjoint document shards. Each sub-agent was admitted with an estimated initial context of ~8k tokens (system prompt + task + schema). The orchestrator's budget was 128k tokens of shared KV-cache residency. Six × 8k = 48k, comfortably within budget, so all six were admitted concurrently. Within seconds, three sub-agents issued tool calls that returned full shard contents (28k, 31k, and 22k tokens respectively). A fourth sub-agent entered a retry loop on a malformed tool response and accumulated 19k tokens of failed-attempt traces before succeeding. The orchestrator's accounting still showed the admitted 48k because no sub-agent had reported completion. The true live footprint was 48k + 81k (tool returns) + 19k (retry traces) ≈ 148k — 20k over the 128k budget. The observable symptom was not a clean rejection. It was **silent eviction of the orchestrator's own working memory**: the oldest turns of the orchestrator's planning trace were truncated to make room, which corrupted its record of which shards had been assigned to which sub-agent. Two sub-agents were subsequently re-tasked onto the same shard, and one shard was never read. The task completed with a plausible-looking but incomplete synthesis. The key observation: **the overcommitment did not manifest at the point of admission**. Every admission decision was locally valid against the snapshot the orchestrator held. The failure surfaced later, as eviction of the *orchestrator's* context — the one context nobody had budgeted for, because it was assumed to be the fixed cost against which sub-agents were admitted. ## Condition of Validity The admission-control invariant is only sound under a condition that is almost never stated explicitly: > The orchestrator's reserved working-memory budget must be computed as `total_budget − Σ(worst_case_post_admission_growth for all admitted sub-agents)`, not as `total_budget − Σ(initial_footprint)`. If the orchestrator admits against initial footprint, the invariant is invalid the moment any sub-agent's growth exceeds the slack. The condition of validity is therefore: **admission must reserve headroom equal to the maximum plausible growth of every concurrently admitted sub-agent, and that maximum must be derived from the tool schemas and retry policies those sub-agents are permitted to use — not from observed historical averages.** Concretely, a sub-agent permitted to call a tool whose response schema has no `max_tokens` bound has an unbounded growth ceiling and must be treated as consuming the entire remaining budget at admission. A sub-agent with a bounded tool response (say, 8k max) and a retry cap of 3 has a growth ceiling of `initial + 3 × 8k = 32k`. The orchestrator must admit against 32k, not 8k. Two corollaries follow: - **Concurrency must be derived from the growth ceiling, not the initial footprint.** A 128k budget with 32k ceilings admits at most 3 concurrent sub-agents after reserving the orchestrator's own working memory (say 16k): `(128 − 16) / 32 = 3.5 → 3`. - **Unbounded tools force serialization.** A sub-agent with an unbounded tool cannot be safely admitted concurrently with any other sub-agent; it must run alone or be given a hard token cap enforced by the runtime, not by the model. ## Decision Boundary The boundary between safe and unsafe admission is crossed at the moment the orchestrator admits a sub-agent whose **growth ceiling plus the growth ceilings of all currently admitted sub-agents plus the orchestrator's reserved working memory exceeds total budget**. This is a pre-admission check against worst-case projections, and it must be evaluated atomically with the admission itself — i.e., the orchestrator must hold a lock (or use a compare-and-swap on a budget ledger) across the read-modify-write of `admitted_ceiling_sum`. The critical decision is what to do when the check fails. Three options, ranked: 1. **Queue, don't reject.** Place the sub-agent in a pending queue; admit it when a running sub-agent completes and releases its ceiling. This preserves task completeness at the cost of latency. 2. **Downgrade the ceiling.** Re-admit the sub-agent with a hard runtime token cap (enforced by truncating tool responses at the transport layer) and a reduced retry budget, so its ceiling fits. This preserves concurrency at the cost of sub-agent capability. 3. **Reject and escalate.** Only correct when the sub-agent's task genuinely cannot be bounded — e.g., it must read an unbounded corpus. Escalation means the orchestrator reports the budget conflict rather than silently degrading. What must *never* happen is admitting anyway and relying on eviction to resolve the conflict. Eviction resolves the conflict by destroying the orchestrator's own memory, which is the one context whose integrity the whole task depends on. ## Operational Effect Enforcing ceiling-based admission changes three observable properties of the system: - **Throughput drops under bursty tool returns.** Because ceilings are reserved up front, the orchestrator admits fewer concurrent sub-agents than the naive initial-footprint calculation would allow. The system trades peak concurrency for the guarantee that no sub-agent's growth can evict the orchestrator's planning trace. - **The orchestrator's working memory becomes a first-class reserved quantity.** It is subtracted before any sub-agent is admitted, and it is never a candidate for eviction. This inverts the default eviction policy (which typically evicts oldest turns first, hitting the orchestrator's planning trace). - **Retry loops become budget-visible.** A sub-agent's retry cap is part of its growth ceiling, so a sub-agent that retries is consuming budget it reserved at admission. This makes retry storms a bounded, accounted-for cost rather than a silent budget leak. The residual risk is ceiling underestimation: if a tool's true response exceeds its declared bound, the ceiling is wrong and the invariant fails again. The guardrail is a runtime hard cap at the transport layer that truncates any response exceeding its declared bound and raises a budget-violation signal to the orchestrator, forcing re-admission accounting rather than silent overcommitment. ```python class ContextBudgetOvercommitError(RuntimeError): """Raised when admitting a sub-agent would exceed the shared context budget under worst-case post-admission growth, not initial footprint.""" pass class BudgetLedger: def __init__(self, total_budget: int, orchestrator_reserve: int): self.total = total_budget self.orchestrator_reserve = orchestrator_reserve self.admitted = {} # agent_id -> reserved ceiling self._lock = threading.Lock() def _admitted_sum(self) -> int: return sum(self.admitted.values()) def free_for_admission(self) -> int: return self.total - self.orchestrator_reserve - self._admitted_sum() def admit(self, agent_id: str, growth_ceiling: int) -> None: # growth_ceiling must be derived from tool response bounds * retry cap, # NOT from the agent's initial prompt footprint. with self._lock: free = self.free_for_admission() if growth_ceiling > free: raise ContextBudgetOvercommitError( f"admission of {agent_id} with ceiling {growth_ceiling} " f"exceeds free budget {free} " f"(total={self.total}, reserve={self.orchestrator_reserve}, " f"admitted={self._admitted_sum()})" ) self.admitted[agent_id] = growth_ceiling def release(self, agent_id: str) -> None: with self._lock: self.admitted.pop(agent_id, None) def derive_growth_ceiling(initial_tokens: int, max_tool_response: int | None, retry_cap: int) -> int: if max_tool_response is None: # Unbounded tool => unbounded ceiling => must serialize. raise ContextBudgetOvercommitError( "cannot derive finite ceiling: tool response is unbounded; " "serialize this sub-agent or impose a transport-layer cap" ) return initial_tokens + (max_tool_response * retry_cap) ```