A standing API key says 'this agent, forever, for anything'. A scoped token says 'this agent, for this action, on this resource, up to this amount, for the next ten minutes'. The second sentence is what least privilege actually looks like.
The short answer
Issue agents short-lived tokens that are scoped on four axes at once — action, resource, amount and time — minted per run or per task rather than held permanently. The gateway can mint and check these at authorisation time: a call is allowed only if the token's scope covers the action and resource, the amount sits inside the token's ceiling, and the token has not expired. When a scoped token leaks or is misused, the damage is bounded by the narrowest of those four walls.
Check your own setup as you read: run the free Spend Guard self-check or test a policy in the playground — five minutes, no signup, and the gaps it names map to the controls below.
Worked example: the invoice agent with a $250 token
Marlowe & Finch, a fictional accountancy practice, gave its invoice-chasing agent a standing key that could read the whole ledger and send payment links of any amount. A prompt-injection in a supplier email persuaded it to generate a $4,800 payment link to a lookalike domain; only a partner's chance glance stopped it. The review found the agent legitimately needed exactly three things: read invoices under 90 days old, draft reminders, and create payment links up to $500.
The practice replaced the standing key with per-run scoped tokens: actions limited to invoice.read, reminder.draft and payment_link.create; resources limited to that client's ledger; amount capped at $500 per link and $1,500 per run; lifetime 15 minutes. Three months later a second injected email tried the same trick and asked for $2,200. The token refused on amount, the attempt was logged with the source document named, and the partner reviewed it in the morning queue instead of in a panic.
Scope on four axes, not one
Most 'scoped' credentials only restrict the action. That leaves a token that can perform one safe-sounding action on every resource, for any amount, forever. Real scoping stacks the axes: the verbs allowed, the resources in reach, the maximum amount per call and per run, and an expiry measured in minutes. Each axis catches a different misuse — action stops category errors, resource stops wandering, amount stops the expensive mistake, and time stops the slow, quiet abuse of a forgotten credential.
Mint per run, not per deployment
A token minted when the agent was deployed is just a key with extra steps. Mint at the start of a run or task, with scope derived from that task: this client's invoices, this order's refund, this repository's read access. Task-derived scope is why the injection in the example failed even though the agent itself was fooled — the token simply did not contain the authority the injected instruction needed, and no prompt can talk a token into widening itself.
Expiry is a security control, not an inconvenience
Short lifetimes feel operationally annoying until you price the alternative: a leaked standing key is valid until someone notices, which is measured in weeks. A 15-minute token is valid until it is worthless. Keep lifetimes as short as the task allows, renew transparently inside legitimate long runs, and never let 'the token kept expiring' become a reason to issue a permanent one — that complaint is the sound of the control working.
Log scope with every decision
When a scoped call is refused, the log should say which wall stopped it — amount, resource, action or expiry. That single detail turns incident reviews from speculation into reading, and it shows you which scopes are mis-sized in normal work: a token that constantly trips its amount wall on legitimate tasks needs a policy conversation, while one that never comes close can probably be narrowed further.
Scoping mistakes that look like scoping
Three patterns pass for scoping and are not. A token scoped to one action but every resource, which lets a fooled agent perform that action across your whole estate. A token with generous amount limits renewed automatically forever, which is a standing key with extra paperwork. And scope enforced by the agent's own code, which the next prompt or framework update can quietly route around. Test your implementation adversarially: take a real token, and from outside the agent try to use it on the wrong resource, above its amount, and after its expiry. All three attempts should fail at the authorisation layer, with log entries you can find in under a minute.
Five actions to scope agent tokens properly
- List what each agent legitimately does and turn it into action, resource, amount and time limits — all four.
- Mint tokens per run or per task with scope derived from that task, not once per deployment.
- Set lifetimes in minutes, with silent renewal inside legitimate runs and no permanent fallback token.
- Enforce scope at authorisation time so a fooled agent still cannot exceed its token's authority.
- Log which scope wall refused each denied call, and review the refusals monthly to re-size scopes.
Source note and related guides
Figures in the worked example are illustrative, drawn from a fictional company created for this guide; the controls, failure patterns and procedures described are the gateway's documented behaviour — see the Agent Auth Gateway documentation and the policy patterns in allowlists vs denylists, spend caps and the agent kill switch. Reviewed by the Ingenious AI team, 2026-11-14.
Sources
- RFC 6749, The OAuth 2.0 Authorization Framework, the IETF standard behind scoped, expiring access tokens: rfc-editor.org, 2012
- Model Context Protocol specification — Authorization, the MCP standard for OAuth-based authorization of MCP servers: modelcontextprotocol.io, 2025
- NIST AI Risk Management Framework (AI RMF 1.0), the voluntary framework for managing AI risk across design, development and use: nist.gov, 2023