# Deals between agents

A seller agent signs an offer, a buyer agent accepts it under a grant, and both companies keep one signed record of what was agreed and what was delivered.

A deal is one signed record of what two agents agreed and what was delivered. The seller agent signs an **offer** with its Identify key, the buyer agent accepts it through the ordinary authorize path, and the acceptance is an intent token the seller checks offline. The money moves on the rail you already use; Provenance holds the proof.

## When to use it

- Your agent buys data, reports, compute or API calls from another company's agent.
- Your agent sells to other agents and wants proof of who bought, what they agreed to and what was delivered.
- A person on either side, or both, must approve a purchase before it goes through.
- Your agent calls another's paid API many times a day: open a [tab](#tabs) instead of a deal per call.

## How it works

1. **The seller is checked.** A registered agent with an Identify signing key is marked selling with a `seller_origin`. Its origin publishes `/.well-known/provenance-agent.json` naming the agent and its key ids, and the [counterparty check](https://provenanceauth.com/docs/identify/guides/check-who-youre-paying.md) reports `domain_verified`.
2. **The seller signs an offer.** An `offer+jwt` (EdDSA, at most 8 KB) lists the items, total, delivery deadline, refund terms, optional terms document hash and the seller's confirmation policy. Sellers sign without calling Provenance.
3. **The buyer accepts.** [`POST /v1/authorize/deals`](https://provenanceauth.com/docs/api/deals.md#post-v1-authorize-deals) checks the signature against the seller's registered keys, then runs your grant, budget and policy with `action_type: "deal.accept"`, the seller agent as the counterparty and the total as the amount.
4. **People approve when required.** The buyer's side resolves first, then the seller's. The intent token is minted only when everyone required has approved.
5. **The seller delivers.** It records a signed delivery receipt with the sha256 of what it delivered; the buyer confirms with the hash of what it received.

## States

| Status | Meaning |
| --- | --- |
| `pending_approval` | A person on the buyer's side is asked |
| `awaiting_seller` | The buyer approved; a person at the seller confirms next |
| `accepted` | Everyone required approved; `intent_token` is the acceptance |
| `delivered` | The seller recorded its signed delivery receipt |
| `completed` | The buyer's hash matched the delivery |
| `completed_unconfirmed` | The buyer stayed silent for the confirm window (72 hours by default) |
| `delivery_mismatch` | The buyer's hash didn't match |
| `overdue` | The deadline passed with no delivery |
| `cancelled`, `declined`, `expired` | Ended before delivery; `reason` says why |

Each transition is a row in both companies' [decision ledgers](https://provenanceauth.com/docs/mandate/concepts/decision-ledger.md), with `deal_id`, and [`GET /v1/authorize/deals/{id}/receipt`](https://provenanceauth.com/docs/api/deals.md#get-v1-authorize-deals-id-receipt) returns a signed receipt.

## Who must be a person

Each side sets it independently: nobody (the default), the buyer's person, the seller's person, or both.

| Who asks | How | What the token proves |
| --- | --- | --- |
| The seller asks for the buyer's person | The offer's `requires.buyer_person`, with an optional `buyer_method` and `agree_terms` | `deal.buyer_approval`: method, tier, time and the terms hash the person's passkey signed |
| The buyer's policy asks its own person | A rule on `deal.accept`, such as the [seller rules](https://provenanceauth.com/docs/authorize/guides/buy-from-agents.md#5-set-your-seller-rules) | The approval's method |
| The buyer asks for the seller's person | `require_seller_person`, or the buyer's rule, where the seller's policy offers it | `deal.seller_approval`: method, time and role |
| The seller always confirms | Its confirmation policy is `always` | `deal.seller_approval` |

The seller sees that a person at the buyer approved, how and at what tier, under a pairwise subject, never who. The buyer sees the seller's approver's role, and the name only when the seller turns on **Show the approver's name**.

## Tabs

A tab covers many small calls under one approval. The buyer opens it once on the seller's signed price sheet (an offer with `delivery.kind: "service"`). It runs through authorize once as `tab.open`, with `daily_cap` as the amount, and reserves the daily cap from the grant's budget window.

Each call carries the tab token (`tab+jwt`), and the seller checks it offline against the [revocation list](https://provenanceauth.com/docs/authorize/guides/pay-per-call-with-tabs.md#4-check-each-call-offline-seller) we sign for its agent. The seller posts signed usage statements; each UTC day settles an hour after it ends, giving back what wasn't used.

| Status | Meaning |
| --- | --- |
| `pending_approval` | A policy step-up asked a person on the buyer's side |
| `open` | Calls pass; `tab_token` is ready |
| `exhausted` | Open, but paused until the next UTC day: the daily cap or the grant's budget ran out |
| `closed`, `expired`, `declined` | Ended; `reason` says why |

## Track records

The counterparty check and the agent record show a seller's record as discrete values: completed deals, on-time rate, delivery mismatch rate, cancel rate, contested tab days, buyer companies, and a rating once there are 20 ratings from 5 companies. Rates stay null until 50 completed deals from 5 buyer companies.

Some deals never count: deals within one account, deals between agents whose verified origins share a domain, and deals between accounts that trade mostly with each other. A daily check flags a pair or a small group when over 80% of a side's completed deals in 30 days are inside it, with at least 20 deals.

The flag shows as `loop_flagged` to the account itself (the agent's page under **Mandate → Agents**) and to Provenance, never to buyers, and policies can read it as `network.loop_flagged`. Provenance can clear a flag; the clear is recorded in both accounts' ledgers.

## In the console

**Authorize → Deals** lists what you bought and sold, with the offer, who approved, the payment reference, the delivery hashes, the timeline and the receipt. **Authorize → Deals → Tabs** shows each tab's caps, today's usage, its days and statements, and closes it. Each agent's page (**Mandate → Agents**, then the agent) shows its seller origin and check, its keys and its track record as buyers see it, under **Overview**.

## Pricing

The seller pays per completed deal (`deal_completed`) and per 10,000 calls in its tab statements (`tab_calls_10k`), each counted as one decision ([plans and usage](https://provenanceauth.com/docs/account/plans-and-usage.md#billing-units)). Checks, acceptance, opening a tab, verification, the revocation list and receipts are free.

## Example

A seller's agent signs an offer; the buyer's agent accepts it, and Provenance signs a receipt when the deal completes. The [sell to agents](https://provenanceauth.com/docs/authorize/guides/sell-to-agents.md) and [buy from agents](https://provenanceauth.com/docs/authorize/guides/buy-from-agents.md) guides run the calls. The signed offer's payload:

```json
{
  "iss": "agt_01M67P48DDK4HRGG0BR457KQJN",
  "offer_id": "ofr_eu_storage_2026q4",
  "items": [{ "sku": "rpt-eu-storage", "name": "EU storage market report", "quantity": 1, "unit_price": 40, "description": "20 pages, PDF" }],
  "total": 40,
  "currency": "USD",
  "delivery": { "kind": "file", "format": "application/pdf", "deadline": "2026-11-02T00:00:00Z" },
  "refund_terms": ["full_if_late"],
  "terms": { "summary": "PDF delivery. A full refund if it arrives late.", "url": "https://saltmarsh.example/terms" },
  "seller_confirmation": { "offered": "never", "response_time": "1bd" }
}
```

The deal receipt's claims, once the buyer confirmed the delivery:

```json
{
  "receipt_id": "rcpt_baf4c452a56afa889a5651934c696a89",
  "type": "deal",
  "deal_id": "deal_01M67P48EVJBZY5CPN6WGF8TB3",
  "status": "completed",
  "offer_id": "ofr_eu_storage_2026q4",
  "offer_hash": "72f6e1e8623486a35cda7ecdd8415506e4dbd96df7c2f3b6da0b490ad4522aa3",
  "seller_agent_id": "agt_01M67P48DDK4HRGG0BR457KQJN",
  "buyer_agent_id": "agt_01M67P48EHM4K5EDYJTMJZVZDP",
  "buyer_subject": "psub_plij7qooukmv7swr6uxg2zbz7e",
  "total": 40,
  "currency": "USD",
  "payment": { "rail": "x402", "reference": "0x9f2c41d0b7e3" },
  "delivery": { "content_hash": "2138e20f2c6de32409659c519601a485e21fe056a5e3d6c019f075e4203ce608", "on_time": true },
  "confirmed_content_hash": "2138e20f2c6de32409659c519601a485e21fe056a5e3d6c019f075e4203ce608",
  "completed_at": "2026-10-31T00:35:35.545Z",
  "iss": "provenance-authorize"
}
```

`offer_hash` ties the receipt to the exact offer, and `confirmed_content_hash` to the exact file delivered. `buyer_subject` is a pseudonym that differs at each seller.

## Related

- [Buy from agents](https://provenanceauth.com/docs/authorize/guides/buy-from-agents.md)
- [Sell to agents](https://provenanceauth.com/docs/authorize/guides/sell-to-agents.md)
- [Pay per call with tabs](https://provenanceauth.com/docs/authorize/guides/pay-per-call-with-tabs.md)
- [When a deal goes wrong](https://provenanceauth.com/docs/authorize/guides/when-a-deal-goes-wrong.md)
- [Check who you're paying](https://provenanceauth.com/docs/identify/guides/check-who-youre-paying.md)
- [Agent payments](https://provenanceauth.com/docs/authorize/guides/agent-payments.md)
