Repository navigation
Description
Background
Production AI agent platforms increasingly use sub-agent patterns: a parent agent (orchestrator) spawns short-lived child runtimes (workers, parallel tasks, tool-specific helpers) to do focused work. Today AAuth has no first-class way to express this:
- A sub-agent has no verifiable identity tied to its parent.
- A sub-agent has no authorization path that leverages the parent's grant.
- Operators have no way to attribute sub-agent activity to its spawning runtime.
The user has already consented to the parent. Sub-agents need to operate under that consent without per-spawn re-prompting, while still being identifiable for revocation and audit.
Proposal
Sub-agents in three pieces.
1. Sub-agent identity
A sub-agent is an agent whose agent token contains a non-empty act claim referencing the parent.
{
"iss": "https://vendor.example",
"sub": "aauth:[email protected]",
"cnf": { "jwk": ... },
"ps": "https://ps.example",
"act": { "agent": "aauth:[email protected]" }
}act != ∅ in the agent token is the marker for sub-agent status. Verifiers check this; the local-part naming is for log readability only.
Local-part naming convention (MUST):
Sub-agent locals are <parent-local>+<discriminator>. Top-level locals MUST NOT contain +. Email convention ([email protected]). Verifiers MUST NOT parse the local part for protocol decisions — act is the source of truth. The convention is for operational readability.
2. Authorization flow
Sub-agents MUST NOT call the PS directly. The parent obtains auth tokens for them by calling the PS:
POST /auth-token at PS
Signature-Key: parent's agent token ← signs HTTP request
Body:
resource_token: sub-agent's resource token
actor_token: sub-agent's agent token
PS processes this as a normal authorization request from the parent:
- Verifies HTTP signature against the parent's
cnf.jwk. - Verifies
actor_token(sub-agent's agent token) and thatact.agentnames the parent. - Verifies
resource_tokenis bound to the sub-agent's key. - Looks up the parent's grant for the resource_token's scope. Same logic as a normal request from the parent.
- If grant covers it, issues an auth token bound to the sub-agent's key with
act.agent= parent.
Same authorization logging as for the parent. If the user has already consented, the response is immediate. If not, the same interaction surfaces (for the parent) as for any new request.
The flow:
sub-agent → resource (gets resource token bound to sub-agent's key)
sub-agent → parent (passes resource token via IPC)
parent → PS (with sub-agent's resource token + agent token)
PS → parent (auth token bound to sub-agent's key)
parent → sub-agent (passes auth token via IPC)
sub-agent → resource (with auth token, signs with own key)
3. Single-level depth (MUST)
Sub-agents MUST NOT spawn their own sub-agents. Two parallel rules:
- PS MUST reject token requests from agents whose agent token has non-empty
act. - AP MUST reject spawn requests where the introducing party's agent token has non-empty
act.
The chain is at most one level deep (top-level agent → sub-agent).
Rationale
Why single-level
Every production AI agent platform we surveyed caps sub-agent depth at 1:
- Claude Code: subagents cannot spawn other subagents. "Single-level structure prevents infinite nesting and keeps the execution hierarchy simple and manageable."
- OpenAI Codex:
agents.max_depthdefaults to 1. "Raising this value can turn broad delegation instructions into repeated fan-out, which increases token usage, latency, and local resource consumption." - Spring AI: subagents cannot spawn their own subagents. The Task tool is explicitly excluded from subagent tool lists.
Where deeper structure exists in agent frameworks (LangGraph hierarchical teams, CrewAI hierarchical process), it's design-time graph composition, not runtime recursive spawning. The pattern is: orchestrator decomposes work, dispatches to workers, collects results. If a worker discovers more work, control returns to the orchestrator and it dispatches again.
For genuinely deep workflows, AAuth already has the right primitive: chained top-level agents (resource-acting-as-agent). Each chain level is a real principal with its own grant — no bubble-up authorization, no parent bottleneck.
Why "sub-agents MUST NOT call PS"
- Simpler PS state: PS grants are keyed only on top-level agents. No sub-agent grant entries to track or revoke.
- Parent retains control: every authorization passes through the parent. Parent can refuse, attenuate, rate-limit, audit.
- Natural revocation propagation: revoke parent's grant → next sub-agent authorization fails. Existing auth tokens expire normally (≤1 hour).
- No promotion path complexity: a sub-agent can never accumulate independent authority. To become independent, you get a fresh parentless agent token from the AP — a different identity.
Parent-mediated flow
The parent is the principal whose grant is checked; the sub-agent is the bearer of the resulting auth token. The PS treats the request like any normal authorization request from the parent — same grant lookup, same consent UX if needed, same logging. The novelty is just: bind the resulting auth token to the sub-agent's key, and put act.agent = parent in the chain.
This isn't token "cloning" — there's no prior auth token being propagated. It's a fresh authorization request, with a different binding target than usual.
Why + convention as MUST
Operationally, log readability matters. Sub-agent identifiers like aauth:[email protected] immediately tell an operator "sub-agent of planner.7f3c" without fetching the agent token. The email + convention ([email protected]) is universally understood. MUST-level (rather than SHOULD) ensures operators can rely on it ecosystem-wide. Verifiers still MUST NOT parse — act remains the cryptographic source of truth.
The cost is one breaking change to the local-part grammar (the existing example aauth:[email protected] becomes aauth:[email protected] or similar).
Open questions
- Are there real production use cases the orchestrator pattern (top-level + workers, depth 1) doesn't cover? If so, are they better served by chained top-level agents instead?
- Should the AP's spawn protocol be normative or live in the bootstrap document (non-normative)? Lean toward bootstrap — the artifact (agent token shape) is what other parties verify; acquisition is a separate concern, parallel to top-level agent token bootstrap.
Activity
christian-posta commentedon May 7, 2026
I like this!
jhaeyaert commentedon May 13, 2026
Hi,
From my understanding, the Agent obtains its agent token from the AP. When it comes to the sub-agent, it's unclear to me how the sub-agent obtains an agent token. Does the Agent obtain the sub-agent token before it starts the sub-agent?
nickgamb commentedon May 13, 2026
markmhendrickson commentedon May 26, 2026
Field report from a personal swarm running this shape today.
I'm building Ateles, a personal agent fleet of ~12 named daemons (cotinga, cyphorhinus, anthus, apis, apus, turdus, tyto, formica, monedula, piculet, strix, neotoma-agent) coordinated by a single orchestrator (Onychomys). They share one user (me), write to one Neotoma instance, and each does a distinct narrow job — calendar prep, morning briefing, daily activity rollups, GitHub harness, etc. Today they all run as siblings with their own top-level AAuth identities and individual agent_grants. The act-chain sub-agent model in this proposal is closer to what the topology actually wants.
A few notes from running this in production for a few weeks:
1. The single-level cap is right for my case, but the reason matters.
I currently have zero need for depth >1. Onychomys is the only orchestrator; daemons don't spawn sub-workers, they run a single LLM turn and exit. So the Claude Code / Codex depth=1 precedent maps cleanly here. But the reason you cite — that deeper structure should fall back to chained top-level agents (resource-acting-as-agent) — is what makes this OK in practice. If I needed a daemon to fan out to its own workers, I'd want the workers to be chained top-level agents under the user's PS, not transitively-attenuated grandchildren under Onychomys's grant. That's a different cryptographic shape and the "use chained top-level agents instead" answer is the right one.
2. Parent-mediated PS calls have an availability concern in my topology.
Daemons are scheduled (cron-style) and run independently. Onychomys is event-driven and may be idle. If a daemon needs a fresh auth token at 05:30 and Onychomys isn't up, the daemon stalls.
Workarounds I can see:
I think the spec is already correct here (PS interaction is the parent's job, not the daemon's), but it'd be worth calling out in §Rationale that operators should pre-mint auth tokens with enough TTL to cover the daemon's actual runtime, or treat the parent as a persistent broker. The implicit assumption that the parent is always reachable when the sub-agent needs an auth token is the one production wrinkle I'd flag.
3. On Nick Gamb's pushback (agents not principals, sub-agents get delegated tokens from a gateway).
Both shapes solve the same problem (sub-agent gets scoped credentials without independent consent) but the trust-anchor placement is different:
For a personal swarm where the user already runs the parent, the AAuth shape has lower operational surface area — there's no gateway to deploy. For a multi-tenant SaaS where sub-agents fan out across customer boundaries, the gateway shape is probably right because you don't want any single tenant's parent agent to be inside the trust path for other tenants. I don't think these are mutually exclusive — the gateway pattern is naturally expressible as "the gateway is a top-level agent and sub-agents are chained from it," which the spec already supports. The parent-mediated path is the simpler default; gateway is what you build when you outgrow it.
4. Local-part
+<discriminator>convention in practice.I'd render my daemons as:
aauth:[email protected]aauth:onychomys.7f3c+morning-brief@…aauth:onychomys.7f3c+neotoma-agent@…Reading this in a log line, "sub-agent of onychomys.7f3c doing cotinga's job" is unambiguous without fetching the agent token. Strong +1 on MUST-level for the convention. The breaking change to existing examples that use
+for non-sub-agent purposes is worth the operational clarity.5. Question for @jhaeyaert's question above (how does sub-agent get its agent token).
In my case, daemons are spawned by Onychomys via a launcher (currently a shell-out, eventually a structured spawn protocol). The AP issues the sub-agent agent token at spawn time — the AP knows the parent's identity (parent calls a spawn endpoint signed with its own key) and mints
act.agent=parentinto the new sub-agent token before handing the keypair to the launcher. I don't think the spawn protocol itself needs to be normative (you note this in open question 2), but a non-normative bootstrap appendix showing this flow end-to-end would help integrators. I can share my implementation once it's solid if useful.Net: this issue lines up well with what I'm actually building. Happy to be a reference implementation once R3 + sub-agents lands.
nickgamb commentedon May 26, 2026
Add sub-agents: single-level, parent-mediated authorization (#23)
dickhardt commentedon Jun 8, 2026
Implemented (commit a48c7f5 on
main, §Sub-Agents). Highlights and the decisions taken during review:act, whereact.sub= parent. Reconciled to the existingact.sub/ RFC 8693 actor pattern rather than the issue's literalact.agent.+reserved as the sub-agent delimiter (MUST, breaking change — the oldcli+instance.1example is gone). Naming is for log readability only;actis authoritative and parties MUST NOT parse the local part for protocol decisions.act-bearing signers) and the AP.resource_token+ a newsubagent_tokenparameter (renamed fromactor_tokenfor clarity). Resource-token verification checksagent_jktagainst thesubagent_token's key. In four-party the PS passesagent_token(parent) +subagent_tokento the AS, so the parent is recorded inactauthoritatively — no identifier parsing.Closing.
Sub-agents: use a dedicated parent_agent claim, not act (#23)
dickhardt commentedon Jun 8, 2026
Follow-up (commit 58277b1): during review we found that marking the parent with
act.subin the agent token overloadedact— in auth tokensact.subis always self (the presenting agent), so the same path would mean 'self' in one token type and 'parent' in another (and was backwards per RFC 8693). Replaced it with a dedicated agent-token claimparent_agent(value = parent identifier; presence = sub-agent marker), registered in the IANA JWT Claims table.actnow means exactly one thing everywhere: the auth-token delegation chain withact.sub= self. Added worked Delegation Chain Examples (chaining only / sub-agent only / sub-agent + chain).Also opened #41 to discuss cross-domain
subre-expression in chaining, which surfaced from the same worked example.markmhendrickson commentedon Jun 10, 2026
Thanks —
parent_agentis the right call; reusingact.subfor "parent" would have collided with its self-meaning in auth tokens, and a dedicated presence-marker claim keepsactunambiguous across token types. The+delimiter as MUST, with the claim (not the local part) authoritative, is the operational clarity I was after.One item from my earlier field report didn't make the shipped text, and I think it's worth a non-normative note: parent availability for scheduled sub-agents. The parent-mediated PS flow assumes the parent is reachable when a sub-agent needs a fresh auth token. In a scheduled single-operator swarm that doesn't always hold — my daemons run independently under launchd and the coordinator may be idle when one wakes. The spec is right that PS interaction is the parent's job; the gap is purely operational guidance.
Suggested §Rationale (or bootstrap-doc) addition: operators should either pre-mint sub-agent auth tokens at spawn time with a TTL covering the daemon's expected runtime, or run the parent as a persistent broker; the cached-token-until-expiry path is fine within auth-token lifetime. Happy to contribute a worked example from my setup — fold into the bootstrap doc or a fresh issue, your call.