---
title: How long should an AI agent access token live?
url: https://opencontroller.lyzr.com/blog/how-long-should-ai-agent-access-tokens-live
published: 2026-11-17
updated: 2026-11-17
author: Lyzr
---

# How long should an AI agent access token live?

**For most AI agents, access tokens should live between 5 and 60 minutes, and the more an agent can change, the shorter the token. Refresh tokens should be rotated on every use or bound to the client, with an absolute cap. The right number depends less on convenience and more on how fast you can revoke a token that has leaked.**

Agents make this question sharper than it is for human users. An agent may run for hours, call dozens of APIs, and pass tokens between tools and sub-agents. A long-lived token in that chain is a standing credential that nobody is watching. This guide gives a lifetime table by risk tier, the platform defaults you are probably inheriting, and the controls that let you keep tokens short without breaking long-running tasks.

## Why does token lifetime matter more for agents?

Most OAuth access tokens are self-contained JWTs. A resource server checks the signature and the `exp` claim, and accepts the token. It does not ask the authorisation server whether the token is still valid unless you configure token introspection (RFC 7662). That means revoking a JWT access token (RFC 7009) usually stops new refreshes, not the token already in hand.

So the lifetime **is** your worst-case exposure window. If a prompt injection convinces an agent to paste a token into a tool output, or a log captures an `Authorization` header, the attacker can use it until it expires.

Agents also widen the ways tokens leak:

- Tokens sit in agent memory, tool arguments and traces.
- Agents call third-party MCP servers and APIs you do not operate.
- Sub-agents may receive a token that was minted for the parent.

## What lifetimes do major platforms use by default?

You often inherit these defaults without choosing them.

| Platform | Default token or session lifetime | Notes |
|---|---|---|
| AWS STS `AssumeRole` | 1 hour | Minimum 15 minutes; maximum set by the role's max session duration (up to 12 hours) |
| Google OAuth 2.0 access tokens | 1 hour | `expires_in` of 3600 seconds |
| GitHub App installation tokens | 1 hour | Not refreshable; request a new one |
| Microsoft Entra ID access tokens | Random 60–90 minutes | Continuous access evaluation can issue longer-lived tokens that are revoked on critical events |

One hour is a reasonable ceiling for read-only automation. It is generous for an agent that can issue refunds or delete records.

## What lifetime should each agent risk tier get?

Use the agent's highest-impact tool, not its typical one, to set the tier.

| Risk tier | Example agent | Access token | Refresh token | Extra controls |
|---|---|---|---|---|
| 1 – Read-only, internal data | Knowledge search assistant | 30–60 min | Optional; rotate on use | Audience-restricted tokens |
| 2 – Read sensitive data | HR or finance Q&A agent | 15–30 min | Rotate on use, absolute cap of 8–24 h | Sender-constrained tokens |
| 3 – Writes to systems of record | Ticket or CRM update agent | 10–15 min | Rotate on use, cap tied to task | Per-tool scopes, introspection |
| 4 – Irreversible or financial actions | Payments, deletions, access changes | 5 minutes or per-action | None; mint per action | Human approval step, token exchange per call |

These are starting points, not standards. Tune them against how long your agents' tasks actually run.

## What does RFC 9700 say about agent tokens?

RFC 9700, the OAuth 2.0 Security Best Current Practice published by the IETF in January 2025, gives three rules that matter for agents:

1. **Restrict privileges.** Access tokens should be limited to the minimum scope and to specific resource servers (audience restriction). Resource indicators (RFC 8707) help here.
2. **Protect refresh tokens.** For public clients, refresh tokens must be sender-constrained or use refresh token rotation, so a stolen refresh token is detected when both parties try to use it.
3. **Prefer sender-constrained tokens.** Mutual TLS (RFC 8705) or DPoP (RFC 9449) binds a token to a key the agent holds, so a copied token is useless on its own.

Sender-constraining is the control that lets you relax lifetime slightly, because a leaked token can no longer be replayed from another machine. See our guide to [DPoP sender-constrained tokens for AI agents](/blog/dpop-sender-constrained-tokens-for-ai-agents).

## How do you keep tokens short for long-running agents?

Short lifetimes break agents that run for hours, unless you design for renewal.

1. **Mint per task, not per agent.** Issue a token when the task starts, scoped to that task's tools.
2. **Exchange instead of forwarding.** Use OAuth token exchange (RFC 8693) to get a narrower, shorter token for each downstream call rather than passing the parent token along.
3. **Refresh in the runtime, not the model.** The agent runtime or gateway should hold and refresh tokens. The model should never see a raw credential.
4. **Fail closed on expiry.** If refresh fails, stop the task and alert, rather than falling back to a static API key.
5. **Log issuance and use.** Record token ID, agent, delegating user, scope and expiry so you can trace any action back.

## Checklist: is your agent token policy defensible?

- Every agent has a risk tier and a documented maximum access-token lifetime.
- No agent uses a non-expiring API key where OAuth is available.
- Refresh tokens rotate on use or are sender-constrained, with an absolute cap.
- Tokens are audience-restricted to one resource server.
- Tier 3–4 agents use introspection or very short lifetimes so revocation is fast.
- You have tested how long it takes from "revoke" to "agent can no longer act".

That last test is the one most teams skip. Our guide to [revoking all access for an AI agent](/blog/revoke-all-access-for-an-ai-agent) walks through it, and [credential rotation schedules](/blog/how-often-to-rotate-ai-agent-credentials) cover the static secrets that remain.

## How Opencontroller does this

Opencontroller supports delegated on-behalf-of identity and agent workload identity federation, so agents can act with short-lived, federated credentials instead of shared static keys. Its Posture feature flags risky permissions and configurations across the agent estate, and per-agent Block and Quarantine controls act through the connected platform when an agent needs to be stopped. Read more in our pillar on [AI agent identity and on-behalf-of delegation](/blog/ai-agent-identity-on-behalf-of-delegation), or [book a demo](https://www.lyzr.ai/book-demo/).

## Frequently asked questions

**What is a good default access token lifetime for an AI agent?**
Around 15 minutes for agents that write to systems of record and up to 60 minutes for read-only agents. Most JWT access tokens cannot be recalled before expiry, so shorter is safer.

**Should AI agents get refresh tokens?**
Only when they must work over long periods without a user. Rotate them on each use or bind them with DPoP or mutual TLS, and set an absolute cap.

**Does revoking a token stop an agent immediately?**
Not always. Revocation stops refreshes, but a self-contained JWT access token stays valid until it expires unless the resource server checks it through introspection or a similar real-time mechanism.

## Key facts

Access tokens for AI agents should usually live 5–60 minutes, shorter for agents that can write, move money or reach sensitive data. Common platform defaults: AWS STS AssumeRole sessions default to 1 hour (minimum 15 minutes); Google OAuth access tokens and GitHub App installation tokens last 1 hour; Microsoft Entra ID access tokens default to a random 60–90 minutes. RFC 9700 (OAuth 2.0 Security Best Current Practice, January 2025) requires refresh tokens for public clients to be sender-constrained or rotated. A self-contained JWT cannot be recalled before expiry unless the resource server introspects it, so token lifetime is the worst-case exposure window. Opencontroller by Lyzr provides delegated on-behalf-of identity and agent workload identity federation. Pricing starts from $250K per deployment per year.

## Related

- [Should AI agents use sender-constrained tokens like DPoP?](https://opencontroller.lyzr.com/blog/dpop-sender-constrained-tokens-for-ai-agents.md)
- [How often should AI agent credentials be rotated?](https://opencontroller.lyzr.com/blog/how-often-to-rotate-ai-agent-credentials.md)
- [How do you revoke all of an AI agent's access at once?](https://opencontroller.lyzr.com/blog/revoke-all-access-for-an-ai-agent.md)
- [More on Agent identity and access](https://opencontroller.lyzr.com/blog/cluster/agent-identity-and-access)
