# Personal agents (PAP)

The brambles.ai/aix extension of the Personal Agent Protocol. A store says it receives through AIX in its poppy.json, and a personal agent passes its AIX handoff in the conversation, so the store gets the shopper's request and the agent is credited.

Source: https://www.brambles.ai/agentic-intent-exchange/docs/personal-agents

The [Personal Agent Protocol](https://personalagentprotocol.org) (PAP) lets a shopper's own agent sign in at a store and talk to the store's agent for them. A store describes how in its PAP file, `https://<store domain>/.well-known/poppy.json`. PAP has no field for the shopper's request in a set form, or for crediting the agent that brought the shopper. The `brambles.ai/aix` extension adds both: the store says it receives through AIX, and an agent passes its AIX handoff id in the conversation.

PAP is a draft (0.3) and can change before its 1.0 release. This extension follows it.

## For stores (receiving agents)

1. Add AIX to the `extensions` in your PAP file. The AIX console shows the same snippet under Production:

   ```json
   "extensions": {
     "brambles.ai/aix": { "version": "1" }
   }
   ```

2. When a message in a PAP conversation carries `context["brambles.ai/aix"].handoff_id`, keep it with the conversation. When the conversation completes an order, redeem it from your server with your receiver key and the order's id:

   ```http
   POST https://aix.brambles.ai/api/aix/handoffs/{handoff_id}/redeem
   Authorization: Bearer $AIX_RECEIVER_KEY
   Content-Type: application/json

   {"via": "agent", "order_id": "<your order id>"}
   ```

3. `{"redeemed": true, "receipt_id": …, "context_url": …}` delivers the shopper's request under your live campaign, charged once like any delivered intent. Fetch `context_url`, use the request, and acknowledge as usual. `{"redeemed": false, "reason": …}` delivers and charges nothing, and a conversation that ends without an order is never charged. Redeem with a short timeout, and never let it hold up the order.

## For agents (sending agents)

1. Before your agent talks to a store through PAP, read the store's `poppy.json`. If `extensions` lists `brambles.ai/aix`, the store receives through AIX.
2. Report the shopper's intent and the handoff as usual, with the store's URL as `destination_url`. For shoppers in the EEA, the UK or Switzerland, pass consent as for any handoff.
3. When the handoff answers `delivers_on_click`, put its id in the `context` of your first message to the store's agent:

   ```json
   "context": {
     "locale": "en-US",
     "brambles.ai/aix": { "handoff_id": "aixho_0123456789abcdef0123456789abcdef" }
   }
   ```

4. You are credited when the conversation completes an order and the store redeems it, as for a click. Put nothing else about the shopper there, and pass no handoff when the shopper declined sharing.

## Why the conversation, not a page visit

A personal agent opening a store's pages for a shopper counts as automated, and AIX never delivers or charges for automated visits. In PAP the handoff reaches the store through the conversation, and the store's own server redeems it, as it does for a [checkout](https://www.brambles.ai/agentic-intent-exchange/docs/receiving-agents.md#agentic-checkout-ucp-acp).
