Skip to main content

Use AI to integrate Personal Agent Protocol

If you use an AI coding assistant like Claude Code, Cursor, or GitHub Copilot, install the Auth0 agent skill. It knows the Poppy SDK options, the CLI commands, and the errors in this guide.Install:
Then ask your AI assistant:
Full agent skills documentation →
Prerequisites:
  • An Auth0 tenant with the Personal Agent Protocol beta enabled. Use a development tenant: this quickstart changes tenant settings
  • Node.js 22 or newer, and Git
  • ngrok with a free account and its authtoken configured. Agents only call public HTTPS hosts
Verify installation: node --version && git --version && ngrok --versionCommands are for macOS and Linux shells. On Windows, use WSL.

Get Started

You start from Drift Bean Demo, a sample coffee store with Auth0 login and guest carts already working. It has a Next.js website, an Express website, and one Node.js API that both websites use. You turn on the Personal Agent Protocol in your tenant, add it to the code with the Auth0 SDKs, and shop the store with a real personal agent, the Poppy Playground.
Want to see the finished result first? Open the Poppy Playground and enter https://driftbeandemo.com.
To get started, pick your website’s stack in the stack selector on the right-hand menu. The steps follow your stack choice.
Next.js: the website in apps/web uses @auth0/nextjs-auth0. The API uses @auth0/auth0-api-js. The starter already has both SDKs installed.
1

Install the Auth0 CLI and log in

The beta build of the Auth0 CLI has the poppy and agents commands:
Log in to the tenant that has the Personal Agent Protocol beta enabled. Every auth0 command in this quickstart runs on the CLI’s active tenant, so check that auth0 tenants list marks it as active, and that the build has the Poppy commands with auth0 poppy --help. If logging in as a user fails, log in with a machine-to-machine application instead:
2

Get the starter store

Clone the starter branch, which contains the sample app without Auth0 configured:
3

Connect the store to Auth0

Create the store’s API and application, and turn on guest carts:
npm run tenant makes its changes with your CLI login and writes .env.local. Run it without --yes to see the plan first. If your login lacks a permission, it prints the auth0 login --scopes command that adds it. If your tenant already has an application named Drift Bean Storefront, it updates that one: pass --client-id to use another.
Start the store:
Open http://localhost:3000, add something to the cart, and sign up. The cart follows you into your account. Leave the store running.
4

Give the store public URLs

In a second terminal in the auth0-poppy-sample folder, open tunnels to the store and its API, and leave it running:
It writes the public URLs to .env.local. In the first terminal, stop the store with Ctrl+C and start it again, so it reads them.In a third terminal in the same folder, load the URLs into your shell, and run the rest of this quickstart there:
If your ngrok URLs change when you restart ngrok, repeat steps 5 and 6. A static domain from the ngrok dashboard avoids that.
5

Turn on Personal Agent Protocol in your tenant

Turn on Poppy for your tenant, API, and application, and write poppy.json, the discovery file your website serves:
setup shows every change before and after, and asks you to confirm. It marks the settings that affect every application in your tenant, and points the application’s Login URI at this store. It also warns that http://localhost:4000 isn’t an https identifier: that’s expected for this local sample.WEB_UNSCOPED, from step 4, is false for the Next.js website: it asks for the API’s scopes at login, so the API can limit an agent to what the customer approved. It is true for the Express website: @auth0/auth0-express can’t ask for API scopes, so an agent joined through it has the customer’s full access there, and the discovery file says so.
6

Allow a personal agent

Let your API accept DPoP-bound tokens, which the Playground’s agent requires. Then register the agent, add the store’s public URLs to its application, and let agents sign customers in with your database connection. Agents are third-party applications, which can only use domain-level connections. Making the connection domain-level opens it to every third-party application in your tenant.
DPoP stays optional on the API, so the storefront’s own bearer tokens keep working. npm run tenant -- --store-url adds the store’s public URLs to the application and never removes existing ones.
7

Serve discovery and accept agent browsers

One SDK option serves /.well-known/poppy.json and /.well-known/oauth-protected-resource, and accepts the login that ends an agent’s browser join.
The SDK takes apps/web/poppy.json, which auth0 poppy setup wrote in step 5, as it is, and the starter’s proxy.ts already lets /.well-known/* through. Pass the file to the client:
apps/web/lib/auth0.ts
8

Show who is driving the browser

After a join, the SDK tells a person from an agent, and an agent guest from a signed-in agent. A guest has no user, so route protection treats it as signed out.
Create the banner, then import it in apps/web/app/layout.tsx with import { AgentBanner } from "./components/AgentBanner"; and render <AgentBanner /> at the top of <body>:
apps/web/app/components/AgentBanner.tsx
9

Verify agent requests at your API

Agents send a signed Poppy-Session header, and an access token once the customer signs in. The SDK verifies both and returns the agent’s Session. Key the cart by that Session, so a cart filled as a guest is still there after sign-in. Both websites use this API, so this step is the same for both stacks. For the Express API SDK, read Add to Your API.Add the poppy options to the API client:
apps/carts-api/src/auth0.ts
Replace the starter’s token check with verifyPoppyRequest:
apps/carts-api/src/auth.ts
In apps/carts-api/src/app.ts, replace the cartKey helper near the top of the file, so it keys the cart by the Session:
apps/carts-api/src/app.ts
Then replace the app.post("/orders", …) route inside createApp, so a signed-out agent is asked to sign the customer in, and a signed-in agent needs orders:write:
apps/carts-api/src/app.ts
The User ID in the Poppy-Session header is chosen by the agent. Act on the customer’s account only with the sub of a verified access token.
10

Shop with a personal agent

In the first terminal, stop the store with Ctrl+C and start it again. Then check discovery, your tenant, and the agent end to end:
Every check should pass, apart from three warnings that are expected for this local sample: D5 and D16 about poppy:browser-sign-in, and D14 about the API’s localhost identifier. Each failure prints a FIX line that tells you how to resolve it.
Open the Poppy Playground, enter your store’s URL, $APP_BASE_URL, and ask the agent to buy a bag of beans. It adds them to the cart as a guest, and the store shows Shopping via https://poppyplayground.dev/agent.json: guest. At checkout, it asks you to sign in: log in on your Auth0 login page and approve the agent. The agent joins again as you, finds the guest cart still there, and places the order.
CheckpointOpen $APP_BASE_URL/orders in your own browser. The order shows Placed by agent. A personal agent shopped your store as a guest, signed you in with your approval, and placed an order that names it.

Troubleshooting

Run auth0 poppy doctor "$POPPY_DOMAIN". Agents compare your discovery files with your tenant character for character, and skip your store without saying why. Most often the tunnel URL changed since you turned on Poppy, or the store wasn’t restarted after npm run tunnel. Repeat steps 4 to 6.
The connection customers log in with isn’t domain-level. Repeat step 6.
The agent requires DPoP-bound tokens and your API doesn’t allow DPoP. Run the proof_of_possession command in step 6.
Auth0’s logs show Prompts are not allowed for an impersonated session for the storefront. The login that ends a browser join can’t show any screen. Check that your API allows skipping consent for first-party applications, and that no post-login Action renders a form during the join.
The agent’s grant must include poppy:browser-sign-in. Repeat step 6.
The SDK compares the URL the agent signed with PUBLIC_ORIGIN. Check that PUBLIC_ORIGIN is the API’s tunnel URL, and that the store restarted after npm run tunnel.
Check that the store and npm run tunnel are both still running, and that $APP_BASE_URL opens in your browser.
For more troubleshooting steps, read Test Your Setup.

See the finished store

The main branch of the sample is the complete store. It marks each Poppy integration point POPPY n/6 in the code, and adds a code tour, labs, a scripted agent for testing without a tenant, and deploy guides. Compare it with yours:

Drift Bean Demo reference app

The finished store and API, with a code tour, labs, and deploy guides.

Live demo

The same store, deployed. Point the Poppy Playground at it.

Add it to your own app

Add to your web app

Serve the discovery files, accept agent browsers, and tell a person from an agent, with the Next.js or Express SDK.

Add to your API

Verify agent requests, enforce scopes, and describe your API for agents, with the Node.js or Express API SDK.

Learn more