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

# Set Up Personal Agent Protocol with the Auth0 CLI

> Use the Auth0 CLI to configure your tenant, API, and web app for the Personal Agent Protocol. Write your poppy.json, register agents, and check the result.

> [!WARNING]
>
> **The Support for Personal Agent Protocol (Poppy) feature is in [Beta](https://auth0.com/docs/troubleshoot/product-lifecycle/product-release-stages.md).**
>
> By using this feature, you agree to the applicable Free Trial terms in Okta's [Master Subscription Agreement](https://www.okta.com/legal).

The Auth0 CLI configures your tenant for personal agents. It writes the `poppy.json` your website serves, registers the agents you allow, and checks the result end to end. Use the Auth0 CLI over [manual setup](https://auth0.com/docs/ai-agents-mcp/personal-agents/set-up-manually.md); agents reject your company if a single value in your discovery files differs from your tenant, and the CLI writes those values for you.

| Command | What it does |
| - | - |
| `auth0 poppy setup` | Checks your tenant, shows the changes it would make, applies them after you confirm, and writes `poppy.json` |
| `auth0 poppy config` | Rebuilds `poppy.json` from your tenant without changing anything |
| `auth0 poppy doctor [domain]` | Checks your website files, your OpenAPI document, your tenant, API, and web app, and each registered agent |
| `auth0 agents register <agent-url>` | Registers an agent and grants it scopes on your API |
| `auth0 agents list`, `show`, `unregister` | Lists, inspects, and removes registered agents |

The `poppy` and `agents` commands are in beta: their behavior, flags, and output may change, so don't rely on them in CI/CD pipelines yet.

## Prerequisites

* The beta build of the Auth0 CLI. To install it, read [Install the beta build](https://auth0.com/docs/deploy-monitor/auth0-cli.md#install-the-beta-build).
* A [custom domain](https://auth0.com/docs/customize/custom-domains) (recommended). The issuer becomes your company's identity for agents.
* An existing [API](https://auth0.com/docs/get-started/apis) with an `https` identifier and a description for every scope. Agents call this API, and they show the descriptions to users.
* An existing first-party [Regular Web Application](https://auth0.com/docs/get-started/applications) for your website, with HTTPS routes for login and callback.
* Your website served over HTTPS on its production domain. Preview domains, such as per-branch hosting URLs, fail the domain checks.
* An OpenAPI document for your API, if agents call it directly. To learn what agents need in it, read [Describe your API for agents](https://auth0.com/docs/ai-agents-mcp/personal-agents/add-to-your-api.md#describe-your-api-for-agents).

## Log in to your tenant

Log in with a [machine-to-machine application](https://auth0.com/docs/get-started/auth0-overview/create-applications/machine-to-machine-apps.md) that is authorized for the Management API:

```bash theme={null}
auth0 login \
  --domain YOUR_AUTH0_DOMAIN \
  --client-id YOUR_CLIENT_ID \
  --client-secret YOUR_CLIENT_SECRET
```

The application needs permissions to read and update tenant settings, APIs, and applications, and to read custom domains. To let `setup` add the refresh token Action, also give it `read:actions`, `create:actions`, and `update:actions`. To register agents, it also needs permissions for agents, applications, and client grants. If a permission is missing, the CLI names it, and the login command adds it automatically.

## Set up your tenant

Preview the changes first:

```bash theme={null}
auth0 poppy setup --dry-run
```

In a terminal, `setup` asks for your company domain, the API agents call, the web app that agents' browsers join, and the URL of your OpenAPI document. Every question has a flag, so you can also run it in scripts:

```bash theme={null}
auth0 poppy setup \
  --company-domain shop.example \
  --api https://api.shop.example \
  --app "Shop Web" \
  --api-url https://api.shop.example=https://api.shop.example/openapi.json \
  --login-uri https://shop.example/auth/login \
  --scope orders:read="See your orders and their status. Read only." \
  --hint orders:read=changes:none,personal_data:true \
  --hint checkout=changes:irreversible,personal_data:true \
  --out poppy.json
```

`setup` shows every change as before and after, marks the settings that affect every application in the tenant, and asks you to confirm. Without a terminal, it can't ask questions, so it names every missing flag at once and you add `--force` to skip the confirmation. Running it again does not change anything once everything matches, and it continues where a failed run stopped. `setup` finishes by running `auth0 poppy doctor`. A failed check doesn't fail `setup` because your website may not serve `poppy.json` until you deploy it.

| Where | What `setup` changes |
| - | - |
| Tenant | Turns on Client ID Metadata Document (CIMD) support, `iss` in authorization responses, and the Resource Parameter Compatibility Profile. Adds your company domain, and rewrites existing company domains that aren't bare hosts as bare hosts. Sets the default audience to your API, but only when you set up one API and the tenant has no other default audience |
| API | Turns on the Personal Agent Protocol, agent subject claims, and offline access. Sets the guest policy to `require_client_grant`. Adds the `poppy:browser-sign-in` scope if the API lacks it, and never edits existing scopes |
| Web app | Turns on the browser join. Sets the Application Login URI if you pass `--login-uri` |
| File | Writes `poppy.json`, or the path you give with `--out` |

`setup` leaves your MFA policy and your existing Actions alone. It creates an Action only when you ask for one, as described in [Add the refresh token Action](#add-the-refresh-token-action).

Three of these settings affect every application in your tenant: `iss` in authorization responses, the Resource Parameter Compatibility Profile, and the default audience. Applications that send no `audience` start receiving tokens for your API. Review these tenant settings before you confirm in the CLI.

If you have no API, or no browser sign-in, pass `--no-api` or `--no-web`. To skip the doctor checks that `setup` runs at the end, pass `--skip-doctor`.

### Describe your scopes for agents

Agents choose scopes from their descriptions and show them to users. `setup` fails if a scope of your API has no description. Add one with `--scope`. It never edits an existing description.

Scope hints tell an agent how consequential a scope is before it asks the user. Add them with `--hint`. Each hint has two values:

* `changes`: `none` if the scope only reads, `reversible` if every change can be undone, or `irreversible` if any change can't be undone, such as placing an order.
* `personal_data`: `true` if the scope shows or changes the user's personal data.

In a terminal, `setup` asks for each description or hint you leave out. Pressing Enter takes the cautious answer.

### Choose what `poppy:browser-sign-in` allows

`setup` asks whether your website treats `poppy:browser-sign-in` as the account's full access on the website. Answer no, the default, when your website only does what your API scopes allow. Answer yes, or pass `--web-unscoped`, when it doesn't. `setup` then sets `web.unscoped` in `poppy.json`. It changes nothing in your tenant: Auth0 still limits the web application's tokens to the scopes the user approved, and your website enforces what unscoped allows. To learn more, read [Website access](https://auth0.com/docs/ai-agents-mcp/personal-agents/how-personal-agents-work.md#website-access).

## Add the refresh token Action

Agents that follow the protocol may not request the `offline_access` scope. Without it, Auth0 doesn't issue them a refresh token, and they have to sign the user in again when the access token expires. Add a [post-login Action](https://auth0.com/docs/customize/actions/explore-triggers/post-login.md) that requests `offline_access` for agents that sign in to your API. The API must also allow offline access, which `setup` turns on. Auth0 drops `offline_access` when the API doesn't allow it.

### Add the Action with the CLI

Add `--always-issue-refresh-tokens` to `setup`:

```bash theme={null}
auth0 poppy setup --always-issue-refresh-tokens
```

`setup` creates the Action, deploys it, and binds it as the last Action of the post-login flow. Your existing bindings keep their order. In a terminal, `setup` asks if you leave the flag out. Without the flag, your post-login flow isn't touched. To remove the Action, unbind and delete it in the Auth0 Dashboard.

### Add the Action yourself

Deploy this Action with your own API identifiers and bind it to the post-login flow. Put it last so it sees the scopes that other Actions set:

```javascript theme={null}
const POPPY_APIS = ['https://api.shop.example']; // Your Poppy API identifiers

exports.onExecutePostLogin = async (event, api) => {
  // An agent is acting when the client is linked to an agent record.
  if (!event.agent || !event.agent.agent_id) {
    return;
  }

  // Only a sign-in to a Poppy API needs a refresh token.
  if (!POPPY_APIS.includes(event.resource_server?.identifier)) {
    return;
  }

  const targetScopes = event.transaction?.target_scopes ?? [];
  if (targetScopes.includes('offline_access')) {
    return;
  }

  api.transaction.addTargetScope('offline_access');
};
```

Every other sign-in is left alone. The token response then includes `offline_access` in `scope`, even if the agent didn't request it. To learn more, read [Write Your First Action](https://auth0.com/docs/customize/actions/write-your-first-action.md).

## Deploy `poppy.json`

Your website serves the document at `https://{company-domain}/.well-known/poppy.json`. If you use an Auth0 web SDK, give it the file as it is: the SDK serves `/.well-known/poppy.json` and `/.well-known/oauth-protected-resource` from it. Otherwise, serve the document yourself as a static file. To learn more, read [Add Personal Agent Protocol to Your Web App](https://auth0.com/docs/ai-agents-mcp/personal-agents/add-to-your-web-app.md).

The file holds no secrets. Run `auth0 poppy config` to rebuild it from your tenant after you change scopes or settings.

## Check your setup

After you deploy your website, run the doctor against your live domain:

```bash theme={null}
auth0 poppy doctor shop.example
```

The doctor groups its checks: website files, Auth0 issuer, scopes, browser sign-in, API, tenant, and agents. Each failure has a `FIX` line with the command or change that solves it.

The checks of your website and the issuer need no login. The checks of your tenant and agents run when you're logged in, and show as skipped otherwise.

During the beta, the doctor may report that Auth0's metadata lacks `protected_resources`, your API scopes in `scopes_supported`, or ES256 in `token_endpoint_auth_signing_alg_values_supported`. These results are marked "Auth0 must fix this" and are expected until the server changes are available in your environment.

## Register agents

Register each personal agent you allow by the URL of its client metadata document:

```bash theme={null}
auth0 agents register https://agent.example/agent.json --api https://api.shop.example --scopes orders:read,checkout,poppy:browser-sign-in
```

`register` previews the agent's metadata document, then creates the agent's application from its CIMD URL, an [agent](https://auth0.com/docs/ai-agents-mcp/agent-as-principal.md) record linked to it, and a grant on your API with the scopes you choose. In a terminal, if you leave out `--api` or `--scopes`, `register` asks you to choose the API and the scopes to grant the agent. Use `--poppy` to grant on every API that has the Personal Agent Protocol enabled. Include `poppy:browser-sign-in` to let the agent browse your website for a person.

The grant limits what the agent can ask for. Users still approve the scopes for their own account on the consent page. Running `register` again refreshes the agent's application from its current metadata document, which is how you pick up keys the agent has rotated.

Auth0 accepts client assertions and delegations signed with ES256, PS384, and RS256. When the agent's metadata document sets `token_endpoint_auth_signing_alg`, Auth0 stores only the keys of that algorithm. When it isn't set, Auth0 stores every key. Run `auth0 agents show` to check that the agent's keys are stored.

To check an agent's document, keys, and grants, run `auth0 agents show`. `auth0 agents list` shows all registered agents.

```bash theme={null}
auth0 agents show https://agent.example/agent.json
```

To remove an agent's grants, record, and application:

```bash theme={null}
auth0 agents unregister https://agent.example/agent.json --dry-run
auth0 agents unregister https://agent.example/agent.json
```

Deleting the agent's application revokes its refresh tokens. Access tokens already issued stay valid until they expire. If you register the agent again, Auth0 creates a new application, and its users must sign in again.

## Next steps

* [Add Personal Agent Protocol to your web app](https://auth0.com/docs/ai-agents-mcp/personal-agents/add-to-your-web-app.md)
* [Add Personal Agent Protocol to your API](https://auth0.com/docs/ai-agents-mcp/personal-agents/add-to-your-api.md)
* [Test your setup](https://auth0.com/docs/ai-agents-mcp/personal-agents/test-your-setup.md)
