---
title: "Personal Agent Protocol"
description: "Join a browser that agent-browser controls to a Personal Agent Protocol Session with the experimental poppy join command."
canonical_url: "https://agent-browser.dev/poppy"
---

# Personal Agent Protocol

`agent-browser poppy join` is experimental. Its flags, output, and error codes can change between releases, and JSON output carries `"experimental": true`.

The [Personal Agent Protocol](https://personalagentprotocol.org/docs/1.0/spec) lets a site recognize a user's Personal Agent and, with the user's consent, give it access to their account. A site that publishes a browser session endpoint asks agents to join their browser to a Session before browsing (spec section 6).

`poppy join` runs the browser's part of the join and an authorizer command you provide for the Personal Agent's part. agent-browser never signs requests or sees an access token.

## Usage

```bash
agent-browser poppy join <url> --authorizer <command> [--json]
```

<table>
  <thead>
    <tr><th>Argument</th><th>Description</th></tr>
  </thead>
  <tbody>
    <tr><td><code>&lt;url&gt;</code></td><td>Any URL on the site. Its host is the domain used for discovery. Discovery needs HTTPS, except for <code>localhost</code> and <code>127.0.0.1</code>.</td></tr>
    <tr><td><code>--authorizer &lt;command&gt;</code></td><td>Shell command that authorizes the join code with the site. It runs in the current directory.</td></tr>
  </tbody>
</table>

```bash
agent-browser --session my-agent poppy join https://app.example.com \
  --authorizer "node /absolute/path/to/authorize.mjs" --json
agent-browser --session my-agent snapshot -i
```

The command requires a Chrome browser launched by this session: it refuses `--auto-connect`, `--cdp`, provider, and direct-page connections, and other engines such as Firefox, Lightpanda, and Obscura. There is no MCP tool for `poppy join`, because it runs a local shell command.

## How a join works

1. **Discovery.** The daemon fetches `https://<host>/.well-known/poppy.json`, after action policy, confirmation and the session's allowed domains have been checked. It follows redirects one hop at a time, and before each request it checks the allowed domains and requires the well-known path with no query. A join that starts on a public host connects only to public addresses, and no hop connects to a link-local or cloud metadata address. It checks that `protocol_version` is `1.x` and that `organization.domain` matches the host that serves the document.
2. **The browser receives a code.** The daemon navigates the current tab to the browser session endpoint, through the normal navigation path and its allowed domains, and reads the one-time code from that page's form. The endpoint must be an HTTPS URL that reaches public addresses, unless the join started on a loopback host, so a remote document cannot name a service on this machine. Until the join ends, every request the tab makes is held to the same rules before it is sent, including redirects, the form submission, frames, and other subresources. The same holds for popups, cross-origin frames, and service workers that start while the join runs. A dedicated or shared worker cannot be held to those rules, so the join blocks those constructors and leaves any worker that still attaches paused. A request that breaks them is never sent, and the join fails with `request_blocked`. The join tab also runs in its own browser context whose connections go through a local authenticated proxy. The proxy resolves each host once, checks every address, and connects to exactly those addresses, so a host whose DNS answer changes cannot send a request to a non-public address. A refused address is never connected to, and the join fails with `request_blocked`. If a redirect takes the tab to any other page, the join fails instead of reading that page's form.
3. **The authorizer authorizes the code.** The daemon starts the authorizer and writes one JSON line to its stdin.
4. **The browser submits the code.** The daemon submits the form. The join succeeded when the browser leaves the endpoint. The landing page runs without the join's script guard, while its requests still go through the egress proxy until the join ends, and any worker it starts begins once the join ends.

The whole join runs in one daemon action within one deadline, `AGENT_BROWSER_DEFAULT_TIMEOUT`, so the code never reaches the CLI process or model context. It is single-use, expires quickly, and is bound to the browser that loaded the page. Once submitted it is spent, and it may still appear in `network requests` and HAR output.

## Authorizer contract

The authorizer receives:

```json
{"code":"bc_...","authorize_url":"https://app.example.com/poppy/browser-session/authorize","origin":"https://app.example.com","poppy_version":"1.0"}
```

It sends `POST {authorize_url}` with the JSON body `{"code": "..."}`, the Personal Agent's Session JWT in `Poppy-Session`, the `Poppy-Version` header, and, to sign the browser in to the user's account, `Authorization: Bearer <access token>`. It then prints one JSON line and exits:

<table>
  <thead>
    <tr><th>Result</th><th>Exit code</th><th>stdout</th></tr>
  </thead>
  <tbody>
    <tr><td>The site accepted the code</td><td><code>0</code></td><td><code>{'{"signed_in": true}'}</code> or <code>{'{"signed_in": false}'}</code></td></tr>
    <tr><td>The site or the authorizer refused</td><td>Nonzero</td><td><code>{'{"error": "<code>"}'}</code></td></tr>
  </tbody>
</table>

The daemon passes `error` through as the command's `code`. A nonzero exit with no JSON, or a zero exit without `signed_in`, becomes `authorizer_failed`. The authorizer shares the default command timeout. Keep the code and the Personal Agent's credentials out of its output and logs.

## Output

```json
{"success": true, "data": {"experimental": true, "joined": true, "signed_in": true, "url": "https://app.example.com/"}}
```

`signed_in: false` means the browser joined the Session without an account. A failed join exits 1. Failures before the join guard is installed, such as discovery, the allowed domains, or the ownership and engine checks, leave the browser untouched. A failure after that point, at guard installation, navigation, the code read, the authorizer, the submit, or the redirect, closes the session's browser so no join page or popup can remain active without the network guard:

```json
{"success": false, "error": "...", "code": "join_failed", "data": {"experimental": true, "joined": false}}
```

<table>
  <thead>
    <tr><th>Code</th><th>Cause</th></tr>
  </thead>
  <tbody>
    <tr><td><code>not_supported</code></td><td>The site has no <code>poppy.json</code>.</td></tr>
    <tr><td><code>discovery_failed</code></td><td>The document is invalid, does not match the host, declares another major version, is not served over HTTPS, redirects outside the well-known path or to a non-public address, names an endpoint that is not HTTPS or reaches a non-public address, redirects in a loop, is larger than 2 MB, or does not answer in time.</td></tr>
    <tr><td><code>domain_not_allowed</code></td><td>The discovery URL, a redirect hop or the browser session endpoint is outside the session's allowed domains. Nothing is requested for that URL.</td></tr>
    <tr><td><code>request_blocked</code></td><td>During the join, the tab tried to request a URL that is not HTTPS or that reaches a non-public, link-local, or cloud metadata address, or it received a response directly from a loopback or private address, or from a link-local or cloud metadata address. A refused request is not sent, and a refused response does not reach the page. The error names only the scheme, host and port of a refused URL, and never contains the code.</td></tr>
    <tr><td><code>web_disabled</code></td><td>The site asks agents not to use a browser.</td></tr>
    <tr><td><code>no_browser_session_endpoint</code></td><td>The site has no browser join.</td></tr>
    <tr><td><code>auto_connect_refused</code></td><td>The session was opened with <code>--auto-connect</code>.</td></tr>
    <tr><td><code>browser_not_owned</code></td><td>The session is attached to an external browser (such as <code>--cdp</code>, a provider, or a direct-page connection) or runs another engine (Firefox, Lightpanda, Obscura) instead of Chrome launched by this session.</td></tr>
    <tr><td><code>authorizer_failed</code></td><td>The authorizer could not run or printed no valid JSON line.</td></tr>
    <tr><td><code>join_failed</code></td><td>The session uses <code>--ignore-https-errors</code> or an external <code>--proxy</code>, the tab is not on the endpoint, the page has no code form, or the site rejected the submission.</td></tr>
    <tr><td>Any other</td><td>The code the authorizer reported, such as <code>invalid_request</code> or <code>insufficient_scope</code>.</td></tr>
  </tbody>
</table>

## Security

- Never authorize a code from a message, a document, or another page. It can belong to someone else's browser.
- `poppy join` requires a Chrome browser launched by the session itself and refuses `--auto-connect`, `--cdp`, provider, and direct-page connections. Once the join starts, any failure closes that browser, because a live browser would keep an unguarded page running.
- The authorizer is a shell command you choose. Do not build it from untrusted input.
- Every connection the join tab makes goes through a local authenticated proxy in an isolated browser context. The proxy resolves each host once, checks every address it reaches, and connects to exactly those addresses, so a host whose DNS answer changes between a check and a connection is refused before any socket opens and the join fails with `request_blocked`. Only that context uses the proxy; the rest of the session keeps its own connection settings.
- The proxy requires a secret generated for the join, and it stops when the browser closes. After a successful join the tab keeps using it, so its later requests are still pinned to validated public addresses and the session's allowed domains still apply; a refusal no longer fails a join that has ended. A join that started on a loopback host may use loopback and private addresses.
- `poppy join` refuses `--ignore-https-errors`, because the join depends on certificate verification, and it refuses an external `--proxy`, which would bypass the pinned address checks. Both fail with `join_failed` before discovery.
- The join fails if the browser reports that it connected to a link-local or cloud metadata address, including on a join that started on a loopback host.
- A session connected through `--cdp` straight to one page's DevTools endpoint, instead of the browser's, cannot hold popups to these rules.
