Subagent Delegation Contracts: Model Subagents as a Capability Seam, Not a Tool Plugin

    This article explains why registering "spawn another agent" as a tool plugin makes delegation boundaries implicit, and how to replace that with an explicit delegation contract enforced by the runtime. It covers the structural problems of the tool-plugin approach, the fields a subagent contract should declare (initiator identity, max nesting depth, tool and data allowlists, session resumption policy, stop conditions and bounded return), registration-time negotiation plus runtime validation, how prompts and protocols divide responsibility, context and failure isolation across nested delegation, per-chain observability and quotas, and a staged rollout path. The payoff is deterministic boundaries guaranteed by types and validation rather than by whether the model remembers the rules.

    Build subagents as a capability seam, not a tool plugin

    In multi-agent systems, the primary model frequently spins up subtasks mid-run: retrieval, code edits, test runs, result aggregation. A very common industry pattern is to register “start another agent” as an item in the tool list. The model reads the tool description and decides on its own whether to call it, how many layers deep to go, and how to carry context across. On the development side, the problem usually surfaces only when the bill or the context window looks wrong — by then delegation has already crossed several layers, and the task tree contains branches that were never explicitly authorized.

    The issue is not whether delegation can be automated. The issue is that the boundary is implicit. Trigger conditions, maximum nesting depth, whether the same session may be continued, and which tools and data a subtask can see are all written in natural language inside prompts or tool descriptions. These are soft constraints: the model may comply, or it may drift during long reasoning. Soft constraints have no types and no validation checkpoints, and they make three questions hard to answer from runtime logs: who initiated this, what layer are we on, and is further delegation still allowed at this layer.

    How a first-class capability differs from a tool plugin

    Tool plugins suit atomic operations with clear boundaries, serializable inputs and outputs, and retryable failures — retrieving a document, running a single read-only query. A subagent is not an atomic operation. It carries its own goal, context budget, tool subset, and stop condition; it runs for a long time and may itself produce subtasks. Forcing it into the tool list creates three structural problems.

    First, the contract is attached to description text, so versioning and compatibility cannot be expressed by a type system. Second, caller and callee share the same “the model interprets the rules” path, so the platform cannot reject illegal nesting before scheduling. Third, observability and billing granularity get mixed in with ordinary tools, making it impossible to apply quotas along the delegation chain.

    A sounder split: a tool remains one implementation of a capability; a subagent becomes a first-class runtime capability, plugged in through a capability seam. The seam is not another tool name — it is an extension point on the runtime: who may register a class of subagent, which contracts must be declared at registration, and at which step the runtime performs hard validation.

    Contracts on the capability seam

    The recommendation is to lift delegation rules out of the prompt and into an explicit protocol covering at least the following, all declared by the provider through types or configuration rather than left to the model’s discretion.

    Initiator identity. Every spawn must carry an auditable parent task ID, the reason for delegation, and the authorization scope. A branch without a parent ID is illegal and rejected outright, rather than allowed to run and discovered later in a UI.

    Nesting depth. Depth is an integer ceiling, stored in task state and persisted with delegation. Before a subtask is created, the runtime compares current depth against the ceiling. Exceeding it returns a structured error instead of relying on a prompt line that says “no nesting.” The ceiling can be configured per tenant, task type, or risk level, but the comparison must happen in the runtime.

    Tool and data visibility. A subagent does not inherit all of the parent session’s tools and context by default. It inherits an explicit allowlist: readable resources, callable tools, and whether writes are permitted. This keeps a subtask from expanding side effects along unauthorized paths.

    Session resumption. Some subtasks do one-shot reasoning; others need multiple turns on the same session. The protocol should declare a resumption policy: new session, read-only parent summary, or continued writes under a controlled identifier. When no resumption is declared, the runtime should not automatically copy the full parent context in.

    Stop and return. A subtask must declare its completion condition, timeout, maximum context consumption, and the structure it returns to the parent (conclusion, evidence references, open questions). The return should be a bounded summary; dumping a whole child transcript back into the parent context will punch through the window quickly once delegation spans multiple layers.

    Capability negotiation

    Do static negotiation at registration and dynamic validation at runtime. Do not skip either half.

    At registration, the provider declares: capability identifier, input and output schemas, maximum allowed depth, whether it may delegate further, dependent tool categories, and failure semantics. The runtime accepts only declarations that pass schema validation. A capability with missing or conflicting fields must not enter the schedulable set.

    At scheduling, the parent task issues a delegation request and the runtime checks in order: whether the parent holds delegation permission, whether enough depth remains, whether the requested tool subset is allowed, and whether the estimated context exceeds quota. Any failure rejects the request and returns an actionable error code to the parent, instead of letting the model “think again, maybe it works now.”

    During execution, depth counting, context metering, and tool calls are all recorded on the same delegation chain. Every hop on the chain is replayable: parent ID, depth, allowlist hash, actual consumption. When something goes wrong, operations sees a protocol violation or an exhausted quota, not an unreproducible prompt.

    How this fits with prompt constraints

    An explicit protocol does not remove the prompt. The prompt still owns the task goal, output style, and business judgment. The protocol owns the non-negotiable safety and resource boundaries. The recommended division: the prompt describes what to do; types and the runtime describe how far it is allowed to go. When the two conflict, the runtime’s rejection wins, and the rejection reason is written back to the parent task so the model can revise its plan rather than silently violating the rule or retrying indefinitely.

    A representative declaration can stay language-agnostic — the point is the fields, not one framework’s interface names:

    1. capability: subagent
    2. max_depth: 2
    3. may_delegate: false
    4. tools_allow: [read_repo, run_tests]
    5. context_policy: summary_only
    6. resume: forbidden
    7. timeout_s: 120
    8. return: { summary, evidence_refs, blockers }

    The parent submits only the goal and input references within the allowed scope. Before creating the child session, the runtime validates max_depth and may_delegate. If the subtask tries to register delegation while may_delegate is false or depth is exhausted, the call fails before entering the model.

    Context and failure isolation

    Multi-layer delegation blows through context mainly because every layer copies the parent session. The capability seam should pass a task summary plus pointers to necessary evidence by default, letting the subtask fetch data on demand rather than cloning everything. The parent consumes only the bounded return. As depth grows, token growth then approaches the sum of per-layer summaries instead of the product of per-layer full texts.

    Isolate failures. A subtask timeout, tool error, or permission violation should terminate that branch and return an error structure upward; it should not automatically spawn an isomorphic subtask and form recursive retries. Retry policy belongs in the parent task or the scheduler, bounded by both attempt count and depth. Write-capable tools should additionally require explicit confirmation or an idempotency key, so failure retries cannot produce duplicate changes.

    Observability and quotas

    Since a subagent is a first-class capability, metrics should aggregate per delegation chain: call count per layer, distribution of rejection reasons, depth histogram, return payload size, and tool-subset hit rates. Quotas can hang on the chain rather than on individual tool calls — for example, a whole refactoring task capped at max depth 2 and N child sessions. Alert on a spike in rejection rate or depth approaching the ceiling, rather than after the context is already exhausted.

    Rollout order

    First, pull the existing “start another agent” entry point out of the tool descriptions and funnel it into a single delegation API. Then add three required fields — depth, allowlist, and return schema — and have the runtime validate them before creation. Next, convert the prompt’s nesting prohibition into handling instructions for the error codes. Finally, add chain logging and quotas. There is no need to replace every tool at once: atomic tools keep using the tool channel, and only units that reason on their own and can delegate further go through the capability seam.

    The benefit is determinism: boundaries are guaranteed by types and validation, not by whether the model happened to remember the rules this time. When you extend the system, adding a new kind of subagent means registering it against the same contract, with no need to restate nesting prohibitions in every prompt. Extensibility comes from the stability of the seam, not from piling more semantics into tool-plugin description text.