# Build with an AI agent

> How to hand a Wagyu integration to a coding agent such as Claude Code or Cursor, what it should read in which order, and the rules it must not break.

These docs are written to be read by people and by AI tools alike. Point your agent at the Markdown and the contracts, not at screenshots.

## What to give the agent

| Resource | Use |
| --- | --- |
| [/llms.txt](/llms.txt) | Index of every page, linking the Markdown copies. Start here. |
| [/llms-full.txt](/llms-full.txt) | Every guide and reference page in one file. |
| Any page + `.md` | The page as plain Markdown, for example [/getting-started.md](/getting-started.md). The **Copy page** button at the top of each page does the same. |
| [/openapi.json](/openapi.json) | The HTTP contract (OpenAPI 3.1), identical to `https://api.wagyu.xyz/v2/docs`. |
| [/asyncapi.json](/asyncapi.json) | The WebSocket contract (AsyncAPI 3.0). |
| `https://mcp.wagyu.xyz` | The [MCP server](https://docs.wagyu.xyz/mcp.md), if the agent should place swaps itself rather than write code. |

## Reading order

1. [Quickstart](https://docs.wagyu.xyz/getting-started.md): the four calls.
2. [Amounts and fees](https://docs.wagyu.xyz/money-and-settlement.md): atomic integer strings, conversion, fees.
3. [Order lifecycle](https://docs.wagyu.xyz/order-lifecycle.md): `status`, `customerState`, actions.
4. [Deposits and refunds](https://docs.wagyu.xyz/deposits.md): short, late and over-deposits, refund addresses.
5. [Errors, limits and retries](https://docs.wagyu.xyz/actions-and-retries.md): error codes and the retry policy.
6. [API keys and fees](https://docs.wagyu.xyz/authentication.md), if the integration earns a fee.
7. [Live updates](https://docs.wagyu.xyz/live-updates.md), if the UI needs real-time progress.
8. The [API reference](https://docs.wagyu.xyz/api-reference.md) and `openapi.json` for exact fields.

## A prompt you can paste

<!-- Prompt -->
```text
Build a Wagyu swap integration. Read https://docs.wagyu.xyz/llms.txt first, then the pages it links in this order:
getting-started, money-and-settlement, order-lifecycle, deposits, actions-and-retries. The HTTP contract is
https://docs.wagyu.xyz/openapi.json. Follow the rules on https://docs.wagyu.xyz/agent-handoff.md exactly.
Call the API from the server, keep the base URL in one config value, and never create a real order in tests.
```

## Rules the code must follow

- Call the API from a server or a native app. Web pages on other sites are blocked by CORS.
- Keep `https://api.wagyu.xyz` in one configuration value.
- Send amounts as atomic integer strings. Convert with the token's `decimals`, never with floats.
- Take token values from the catalog. Do not invent addresses or rely on `"native"`.
- Treat the quote as an estimate. Show the created order's `depositAddress`, `depositAmount` and `expiresAt` exactly.
- Never retry `POST /v2/swaps` or `POST /v2/bridges` automatically. There is no idempotency key.
- Store `sessionId` privately and send it only in the `X-Session-ID` header.
- Render progress and actions from `customerState`. Offer an action only for `kind: "action_required"`.
- Branch on error `code`, never on the message. Honour `Retry-After` on `429`.
- Never commit an integrator key. Use `wg_YOUR_KEY` in examples and read the real key from the environment.

## Testing without moving money

There is no sandbox, and every created order is real. What can be tested freely:

- Every `GET` route and `POST /v2/swaps/quote` are read-only.
- `GET /v2/orders` with a fresh random session returns `{ "orders": [] }`.
- Reading a made-up order id returns `404`, and a made-up order on a WebSocket closes with `4404`.

An order that is created but never funded simply expires at `expiresAt`. Nothing moves until a deposit is sent, so tests should stop before sending funds.

---
Source: https://docs.wagyu.xyz/agent-handoff · Built from the live Wagyu API on 2026-12-04.
