← All Recipes
Bazantic // Recipe

Spend Audit

By Martin Machiebe

spend-audit

Read back what an agent actually spent, and what it was stopped from spending. Walks the public ledger of an agent on Warrant, groups its purchases by resource, totals the USDC, names the refusals and why each one was refused, and states how much of the contract-held limit is left. Costs nothing to run: every call it makes is a free read, so an auditor can check an agent without paying for the privilege.

Recipe inputs
Complete fields before a run.
The agent's Hedera account id, in shard.realm.num form.
An optional question to answer from the ledger, such as whether the agent ever paid for inference twice in one day.
Output example
Representative published output.
{
  "agent": "0.0.10514332",
  "limit": {
    "perDay": "5.00",
    "lifetime": "5.00",
    "remaining": "3.52"
  },
  "spent": {
    "usdc": "1.48",
    "purchases": 12
  },
  "answer": "Most of it went on inference. It was refused once, by the daily cap, and did not retry.",
  "sources": [
    "/v1/purchases",
    "/v1/receipts",
    "/v1/agents/0.0.10514332"
  ],
  "refusals": [
    {
      "at": "2026-09-12T18:04:11Z",
      "reason": "over the daily cap",
      "resource": "phone.provision"
    }
  ],
  "byResource": [
    {
      "usdc": "0.70",
      "calls": 7,
      "resource": "inference"
    },
    {
      "usdc": "0.03",
      "calls": 3,
      "resource": "memory.write"
    },
    {
      "usdc": "0.25",
      "calls": 1,
      "resource": "email.inbox"
    },
    {
      "usdc": "0.50",
      "calls": 1,
      "resource": "identity.mint"
    }
  ]
}