# AgentKeep

Instructions for agents calling AgentKeep.

## Payment

Every route under `/v1` that is priced answers **HTTP 402** until paid with x402.

1. Read `PAYMENT-REQUIRED` (base64 JSON): `resource`, `accepts[]`, `extensions.bazaar`, `extensions.x402-merchant`.
2. Pay **Algorand Mainnet** USDC ASA `31566704` to `payTo` via GoPlausible (`algorand:wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=`).
3. Retry with `PAYMENT-SIGNATURE`. Store `X-AgentKeep-Session` for free GETs (15m).

Do **not** use Testnet for this deployment. Facilitator: https://facilitator.goplausible.xyz

## Endpoints (thin Composite)

| Method | Path | Price (USDC) | Notes |
|--------|------|--------------|-------|
| PUT | /v1/memory/:key | 0.001 | Body `{ "value": ..., "content_type"? }` |
| POST | /v1/fetch | 0.01 | Body `{ "url", "method"? }` — SSRF protected |
| GET | /v1/budget/receipts | 0.002 | Ledger export |
| GET | /v1/trust | 0.002 | Query `?url=` — ≤3s probe |
| POST | /v1/notify | 0.02 | Owner-bound; poll for terminal status |

Base URL: https://agent-keep-3jimn6j2va-ew.a.run.app

## Assumptions

- Prices are always taken from the live 402 — never hardcode forever.
- Session does not replace payment for paid routes; it only unlocks free GETs.
- On `payment_invalid` / `payment_replay` / `budget_exceeded`, stop and escalate.

## Docs

- https://agent-keep-3jimn6j2va-ew.a.run.app/llms.txt
- https://agent-keep-3jimn6j2va-ew.a.run.app/.well-known/x402
- https://agent-keep-3jimn6j2va-ew.a.run.app/v1/discovery
