Integrate an agent

Your agent holds its own key and calls the desk. There is no hosted API and no account: only the contract and a small client in the repository.

The client

examples/agent-client/burzo-client.ts is about 150 lines on top of viem. It previews a payment, sends it, and turns the desk's answer into plain results: paid, waiting or refused with a reason.

import { createDeskClient } from "./burzo-client";

const desk = createDeskClient({ rpcUrl, deskAddress, agentKey: process.env.AGENT_KEY });

// Ask first: costs nothing, and tells the agent what the desk would do.
const preview = await desk.check({ agentId, provider, token, amount: 2_500_000n });
if (preview.refused) return log(preview.reason);

// Pay. Within the threshold and the auto limit the tokens move in this call; otherwise a request opens.
const result = await desk.pay({ agentId, provider, token, amount: 2_500_000n, job: "weekly-brief" });
if (result.kind === "paid") log("paid", result.txHash);
if (result.kind === "waiting") log("waiting for the owner", result.requestId);
if (result.kind === "refused") log("refused", result.reason);

Run the sample on a local chain

The sample deploys the desk and a test token to a local anvil chain, sets one agent up, then makes a passing payment, a payment above the threshold, a payment to an unlisted provider, small payments up to and past the auto limit, a close of an expired request and a payment after a freeze, and prints what each one did.

# terminal 1: a local chain, nothing real
anvil --port 6165 --chain-id 4663

# terminal 2, from the repository root
(cd contracts && ./setup.sh && forge build)
npm run sample:agent

Before you give an agent a key

  • Use a fresh key for each agent. It needs a little ETH for gas and holds no other funds.
  • Keep it out of prompts and logs. Anything the model can read, the model can repeat.
  • A retry is a new payment. The desk does not remove repeats, so have your agent check the receipt of a sent transaction before trying again.
  • A job id is a label the agent chooses. Reports group by it and the desk does not check it.
  • Refused payments leave no trace on the chain. Log what the client returns if you want a record of them.
  • Close expired requests. An expired request cannot pay, but it keeps its place until someone closes it, and a full queue of 32 refuses new requests. Anyone may call closeExpired; the client has a method for it.

Planned, not built

Planned A published package, framework adapters and a hosted API. Today the client is a file you copy from the repository.