SKIP TO CONTENT
AI AGENTS6 minAgents in Production / Ep. 13 · Stage 13-2

Sub-Agent Permissions: How Token Exchange Can Narrow Access

Your orchestrator may pay invoices. Should the sub-agent that only reads them carry the same rights?

XIN
Pixel-art night scene: a small robot at a glowing kiosk trades one big brass master key for a tiny teal key tied to its wrist by a light thread, while a sand timer above the slot runs down.

IN 30 SECONDS

Token exchange is a request where a sub-agent hands its parent’s token and its own identity to the authorization server, and asks for a narrower token. In my design, the server decides how narrow: one API, part of the scope, an expiry no later than the parent’s.

KEY TAKEAWAYS · 3

  • RFC 8693 token exchange lets a sub-agent trade the parent’s token plus its own identity for a narrower token, if the server agrees.
  • In my design, the authorization server does the narrowing, not the agent: scope inside the parent’s, one API per token, and an expiry never later than the parent’s.
  • Revocation does not spread on its own: check the parent on every exchange, and in your APIs if minutes matter.
On this page

Token exchange: one request, one narrower token

IN SHORT In one request, the sub-agent hands over the parent’s token and its own identity, and gets back a token for one job.

WORDS TO KNOW

Authorization server
The server that checks who is asking and issues access tokens, under OAuth, the web’s common authorization framework. It decides; the agent only asks.
Token exchange
Asking the authorization server to swap one token for another. RFC 8693 sets the rules; the server decides how narrow the new one is.
Scope
The list of actions a token allows, such as reading invoices but not creating payments.

Token exchange Asking the authorization server to swap one token for another. RFC 8693 sets the rules; the server decides how narrow the new one is. See the glossary is defined by RFC 8693, a published Standards Track RFC. Besides the two tokens, the sub-agent names the API it wants to call and the Scope The list of actions a token allows, such as reading invoices but not creating payments. See the glossary it needs.

The Authorization server The server that checks who is asking and issues access tokens, under OAuth, the web’s common authorization framework. It decides; the agent only asks. See the glossary also keeps a ceiling for each sub-agent: the most it may ever hold, whatever its parent has.

A WORKED EXAMPLE

Illustrative numbers

PASSThe fetcher asks to read invoices

INPUT

Parent scope
invoices:read payments:create
Parent expires
in 30 min
Fetcher ceiling
invoices:read
Asks for
invoices:read on the ledger API

WHAT HAPPENS

  1. The server checks the parent token: valid, not expired, not revoked.
  2. invoices:read is in the parent’s scope and in the fetcher’s ceiling.
  3. The ledger API is on the fetcher’s list of allowed APIs.
  4. The expiry is the earlier of the parent’s and now plus five minutes.

OUTPUT

Scope
invoices:read
API
ledger only
Expires
in 5 min
Bound to
the fetcher’s DPoP key

REFUSEDSame fetcher asks to create payments

INPUT

Asks for
payments:create

WHAT HAPPENS

  1. The parent holds payments:create.
  2. The fetcher’s ceiling doesn’t, so nothing is left to grant.

OUTPUT

Result
400 invalid_scope (my mapping), no token

RFC 8693 separates two cases. Impersonation makes A “indistinguishable from B”. Delegation keeps A’s own identity, and “any actions taken are being taken by A representing B.”

IN PLAIN WORDS

You want delegation. The new token records it in its act claim, the field that names who is acting.

Coming up next: But what stops a sub-agent from simply asking for more?

How do you give a sub-agent fewer permissions than its parent?

IN SHORT Narrowing only exists if the authorization server enforces it, one check at a time.

RFC 8693 lets a client ask for a narrower scope. It doesn’t force anyone to.

An agent asking politely for less is not a control: an injected agent can just as politely ask for more.

ATTENUATION AT THE SERVER

Flow diagram: 6 stepsFlow diagram: 6 steps. Check the parent token, then Authenticate the actor. Authenticate the actor, then Cap the chain depth. Cap the chain depth, then Intersect the scope. Intersect the scope, then Check the audience. Check the audience, then Mint the token.1Check the parent token2Authenticate the actor3Cap the chain depth4Intersect the scope5Check the audience6Mint the token
The requested scope must sit inside the parent’s scope and this actor’s ceiling. Empty means refuse, not “all”.

Step 1. Parent token. Signature, issuer, not expired, not revoked. A dead parent cannot have children.

Pick a step to see it move
  1. Parent token Signature, issuer, not expired, not revoked. A dead parent cannot have children.
  2. Actor The sub-agent’s identity is valid, and it may act for this parent.
  3. Depth Sub-agents of sub-agents stop at a fixed depth, for example 3.
  4. Too wide: refused The fetcher asks for payments:create. Crossed with the parent’s scope and its ceiling, nothing is left: no token.
  5. Audience With a scope inside both, the server checks the target API is on this actor’s list.
  6. Mint The token expires no later than the parent, names every actor in the chain and works only with the sub-agent’s key.
Each check fails closed: a failed check refuses the request. The cheapest checks come first. This limits what an injected agent gets, not the injection.

The per-actor ceiling means even a broad parent can’t hand a fetcher the right to pay. And the expiry is the earlier of the parent’s and the actor’s time limit (its TTL), so once the orchestrator’s token expires, its whole tree is gone within minutes.

ITEM GET

The server narrows, not the agent

Scope inside the parent’s and the actor’s ceiling, one API per token, and an expiry never later than the parent’s.

Revocation is different. RFC 8693 says propagating it “is not a general property of the STS protocol” (its name for the token service). So my server checks the parent’s revocation status on every exchange.

WATCH OUT

Children already issued live out their few minutes, unless your APIs check revocation too.

Mapping refusals to invalid_request, invalid_scope and invalid_target is my choice. RFC 8693 defines invalid_target for audiences it can’t serve.

FAQ

With RFC 8693 token exchange: the sub-agent sends the parent’s token and its own identity, and asks for one scope on one API. In my design, the authorization server checks the scope is a subset, the API is allowed and the chain isn’t too deep. The expiry never passes the parent’s.

STAGE CLEAR

What you now know

  • How a sub-agent gets its own narrower token: it trades the parent’s token and its own identity in one RFC 8693 request.
  • Who decides how narrow, in my design: the authorization server, against the parent’s scope, the actor’s ceiling and its list of APIs.

Check yourself

Tap or click a question to see the answer.

Illustrative case: a parent token expires in 2 minutes, and the fetcher’s TTL is 5 minutes. When does the fetcher’s new token expire?

In 2 minutes. The server takes the earlier of the two, so a child never outlives its parent.

Next stage:How do you stop a copied token from working, and is that settled in the standards yet?6 min
Adam Boudjemaa
Adam Boudjemaa

Web3 x AI engineer, former CTO of Integra. Named author (1 of 5) of ERC-3643, first author of ERC-6960, co-author of ERC-7410, and co-author of ERC-8203, which is still a draft.

Have a project to ship or a role to fill?

Discuss your project or role

My work at the web3 x AI intersectionOpen-source tools I build

Follow the engineering notes

Get new articles on production AI and smart contracts by email.