> ## Documentation Index
> Fetch the complete documentation index at: https://docs.didit.me/llms.txt
> Use this file to discover all available pages before exploring further.

# Agent Access: Let Your Users' AI Agents Act for Them

> Let people approve their own AI agents to act for them in your app, in a scoped session that ends on its own and that the person or your team can revoke.

Didit Authentication's agent access lets the people who use your app approve their own AI agents to act for them.
The person sees what the agent asks for, approves it, and the agent gets a scoped session of its own that ends on its own and that the person or your team can revoke at any time.
Your backend tells an agent's request apart from the person's by the `act` claim in the token.

Agent access is included on every plan, with no separate price.

## How it works

1. An AI agent asks to act for a person in your application, naming the scopes it needs.
2. The person signs in on your application's hosted approval screen, or on your own consent screen, and sees the agent's name, whether it is verified, and what it asks for.
3. The person can narrow the request (fewer scopes, a shorter session, only some of their [organizations](https://docs.didit.me/authentication/organizations.md)), then approves it, with a fresh passkey when your settings ask for one.
4. The agent receives a single-use code and exchanges it for its own tokens. Its access tokens last at most 5 minutes, like a person's.
5. Every request the agent makes to your backend carries a token whose `act` claim names the agent and the scopes the person approved.

The agent's session ends when its lifetime passes, after your idle timeout, or when the person or your team revokes it.

## Turn it on and choose the rules

Agent access is off for a new application.
Turn it on under **Authentication > Agent access**, then choose **Edit settings**:

| Setting | Options | Default |
| - | - | - |
| What agents can do | **Read only** (`read`): see the person's account information. **Acts for them** (`act`): change the person's account settings and preferences. | None until you choose |
| Which agents may ask | Any agent can ask today, and the approval screen shows whether it is verified. Allowing verified agents only is not available yet. | Any agent |
| How long a session lasts | 1, 7 or 30 days. | 7 days |
| Ends when idle for | 30 minutes, 2 hours or 24 hours. | 2 hours |
| How people approve | **A passkey**, or **Their usual sign-in**. | A passkey |
| Only people approve agent requests | Each approval needs a fresh assertion from the approving person's own passkey. | Off |

People can turn any scope you offer off on the approval screen, never on.
Changes apply to new approvals: active agent sessions keep what the person approved.

**Only people approve agent requests** (`agent_humans_only`) can be changed only by an Owner or Admin of your Didit organization, who needs a passkey on their own console account first.
It proves that the approving person used their own authenticator with user verification, within five minutes and tied to that request; it does not detect automation in general.
For your own consent screen, the calls are in [agent approval with a passkey](https://docs.didit.me/authentication/sign-in-methods.md#agent-approval-with-a-passkey).

## Add it to your app

Agents that support it send people to your approval screen on their own.
Your app does two things:

**Let people see and revoke their agents.**
In React, render `<ConnectedAgents />` on the account settings page: it lists the agents the person approved, each with a **Revoke** button.
See the [React quickstart](https://docs.didit.me/authentication/quickstarts/react.md).

**Check the `act` claim on your backend.**
An agent's access token is signed with the same key and carries the same `typ`, `iss` and `aud` as a person's, so only `act` tells them apart:

| `act` | Who is calling | What to allow |
| - | - | - |
| `null` | The person. | What the person may do. |
| `{"sub", "agent", "scopes"}` | An AI agent acting for the person. | Only what `act.scopes` grants, on the routes you open to agents. Reject it everywhere else. |

`sid` in an agent's token is the ID of the access the person granted, and `GET /session/` always rejects an agent's token.
See [verify a token on your server](https://docs.didit.me/authentication/tokens-and-jwks.md#verify-a-token-on-your-server) for the checks in code.

## Watch and revoke in the console

**Authentication > Agent access** shows:

* **At a glance:** active agent sessions, sessions people approved in the last 7 days, people with an agent, and revocations this month, by people and by your team.
* **Active agent sessions:** each person, the agent with its description and whether it is verified, what it can do, its last activity and when it ends, with a **Revoke** button.

![The Agent access page in the Didit Business Console, with the agent settings, key metrics and the active agent sessions with a Revoke button](https://mintcdn.com/didit-0f962782/RpqZjIB1GnUPdMTN/images/authentication/console-agent-access.png?fit=max\&auto=format\&n=RpqZjIB1GnUPdMTN\&q=85\&s=7cc518e37e2ccafa5515eb22e6ef9b8d)

Authentication > Agent access.

Revoking ends the agent's session at once, and you can email the person that it ended.
Your team can also end every agent session of one person: blocking a person, resetting their MFA or revoking their sessions from **Users** revokes their agent access too.

## Emails and events

When your team revokes an agent's access from the console, you can choose to email the person that it ended.
The email uses your brand, like every [sign-in email](https://docs.didit.me/authentication/branding-and-custom-domain.md#sign-in-emails).

Approvals and revocations are recorded as `security.agent_access_approved` and `security.agent_access_revoked` events on the person's timeline.
Didit records an approval when the person consents, even if the agent never exchanges its code.
See [agent approval audit](https://docs.didit.me/authentication/events-and-webhooks.md#agent-approval-audit).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.