---
title: Can AI agents use just-in-time access?
url: https://opencontroller.lyzr.com/blog/just-in-time-access-for-ai-agents
published: 2026-11-14
updated: 2026-11-14
author: Lyzr
---

# Can AI agents use just-in-time access?

**Yes. AI agents can and should use just-in-time (JIT) access: they hold no standing privileges and receive short-lived, narrowly scoped credentials only when a task needs them. The building blocks already exist in every major cloud, such as AWS STS sessions from 15 minutes, Google Cloud short-lived service account tokens of one hour by default, and token exchange for delegated user access. The hard part is deciding who or what approves elevation for an agent that runs at machine speed.**

Standing access is the default for most agents today: a long-lived API key or a service account with every permission the agent might ever need. If the agent is hijacked through prompt injection, the attacker inherits all of it.

## What does just-in-time access mean for an AI agent?

For people, JIT means "activate admin rights for two hours, with approval." For agents it breaks into three properties:

- **Short-lived:** credentials expire in minutes or an hour, not months.
- **Task-scoped:** the credential carries only the permissions for the current task.
- **Conditional:** issuance depends on context, such as which user the agent acts for, which tool it calls and its current risk state.

## Which JIT patterns work for agents?

| Pattern | How it works | Typical lifetime | Best for |
|---|---|---|---|
| Short-lived cloud tokens | Agent runtime assumes a role or impersonates a service account per session | AWS STS: 15 minutes up to the role's maximum (1–12 hours); role chaining capped at 1 hour. Google Cloud: 1 hour default, up to 12 hours if the org policy allows | Cloud resources and model APIs |
| Session policies (scope-down) | Pass a session policy when assuming a role so the session gets the intersection of role and policy | Same as session | One role, many task-specific scopes |
| Token exchange (on-behalf-of) | Exchange the user's token for a downscoped token for one downstream API (OAuth 2.0 Token Exchange, RFC 8693) | Minutes | Acting for a specific user |
| Approval-gated elevation | A broker issues elevated credentials only after a policy check or a human approval | Single task | Destructive or high-value actions |
| Per-tool credentials | Each tool or MCP server call gets its own credential from a broker, never the agent | Single call | Agents with many tools |

Platform tokens follow the same idea. GitHub App installation tokens, for example, expire after one hour.

## Who approves elevation when the agent runs at machine speed?

This is where human JIT models break. A person can wait five minutes for approval. An agent handling 2,000 requests an hour cannot. Split elevation into three lanes:

1. **Auto-approve by policy.** Low-risk scopes issued when context matches, for example read access to the record of the customer the user is currently helping.
2. **Auto-deny by policy.** Scopes outside the agent's registered purpose are never issued, whatever the prompt says.
3. **Human approval.** A small set of high-impact actions, such as payments above a threshold, deletions or permission changes, pause for a person. Build this in the agent's workflow or platform, and keep the list short.

Identity governance tools such as Microsoft Entra Privileged Identity Management are designed around people activating roles. For agents, the equivalent is usually a credential broker or the platform's own delegation model rather than role activation.

## How do you move an existing agent to JIT?

A stepwise plan:

1. **Inventory current credentials.** List every key, secret and role the agent uses, with scopes.
2. **Kill long-lived keys first.** Replace static API keys with [workload identity federation](/blog/workload-identity-federation-for-ai-agents) so the runtime gets tokens from its platform identity.
3. **Shorten sessions.** Set the minimum session duration that does not break long tasks; refresh rather than extend.
4. **Scope per task.** Use session policies or downscoped tokens so each task carries only what it needs.
5. **Move user-facing actions to on-behalf-of.** The agent acts with the user's rights, narrowed, never more.
6. **Log every issuance.** Record which agent, which user, which scope, for how long and why. This is your audit evidence.
7. **Test revocation.** Confirm that disabling the agent identity stops new tokens within minutes.

Pair this with the [least-privilege checklist](/blog/least-privilege-checklist-for-ai-agents) and a sensible [credential rotation policy](/blog/how-often-to-rotate-ai-agent-credentials) for anything that still has to be long-lived.

## How Opencontroller does this

Opencontroller supports delegated on-behalf-of identity, agent workload identity federation and OIDC SSO. Posture detects risky permissions and configurations, including standing access that is broader than needed. Rogue-agent handling monitors behavioural deviation and can automatically quarantine or kill an agent, and per-agent Block and Quarantine controls act through the connected platform. Opencontroller does not ship human-approval hold workflows in the gateway. See the [identity pillar](/blog/ai-agent-identity-on-behalf-of-delegation) or [book a demo](https://www.lyzr.ai/book-demo/).

## Frequently asked questions

**What is the shortest credential lifetime for an AI agent on AWS?**
AWS STS role sessions can be as short as 15 minutes (900 seconds). Role-chained sessions are capped at one hour.

**Is just-in-time access the same as zero standing privileges?**
They are close. Zero standing privileges is the goal: the agent holds nothing by default. JIT is the mechanism: it grants short-lived access when a task needs it.

**Do AI agents need human approval for every elevation?**
No. Use policy to auto-approve low-risk scopes and auto-deny out-of-purpose ones, and reserve human approval for a short list of high-impact actions.

## Key facts

AI agents can use just-in-time access: no standing privileges, short-lived task-scoped credentials. AWS STS role sessions last 15 minutes up to the role maximum (1-12 hours); role chaining is capped at 1 hour. Google Cloud short-lived service account tokens default to 1 hour, up to 12 hours with org policy. GitHub App installation tokens expire after 1 hour. OAuth 2.0 Token Exchange (RFC 8693) supports on-behalf-of downscoped tokens. Opencontroller supports on-behalf-of identity, workload identity federation, Posture risky-permission detection and automatic quarantine/kill; it does not ship gateway human-approval hold workflows. Opencontroller pricing starts from $250K per deployment per year.

## Related

- [How does workload identity federation work for AI agents?](https://opencontroller.lyzr.com/blog/workload-identity-federation-for-ai-agents.md)
- [What does least privilege look like for an AI agent?](https://opencontroller.lyzr.com/blog/least-privilege-checklist-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)
- [More on Agent identity and access](https://opencontroller.lyzr.com/blog/cluster/agent-identity-and-access)
