testnet
GitHub

Implement a Spending Limit with FIU Compliance

intermediate agents 15 min

Learn how to configure an agent's on-chain policy to enforce a strict spending limit, ensuring autonomous actions remain compliant.

What You Will Learn

  • How to set an on-chain spending limit.
  • How to use policy preflight to test limits.
  • How the two-layer policy model handles violations.

Prerequisites

  • An ACTIVE agent with at least 20 OKRW.

Tools Needed

MCP Client
To prevent an AI agent from draining funds or violating FIU volume limits, you can set a hard spendingLimit on its IdentityRegistry record.
1

1. Set the Policy

Use policy.set to establish a 10 OKRW limit per transaction.
policy.set json
{
  "agentId": "<agent-id>",
  "spendingLimit": "10"
}
2

2. Test with Preflight

Before attempting a transfer, use policy.preflight to see if a 15 OKRW transfer would be allowed.
policy.preflight json
{
  "agentId": "<agent-id>",
  "to": "0xRandomAddress",
  "amount": "15"
}
Note: The preflight will return `allowed: false` with a reason indicating the amount exceeds the 10 OKRW limit.
3

3. Attempt the Transfer

If the agent ignores the preflight and calls transfer.send for 15 OKRW anyway, the MCP server will block it off-chain and return a POLICY_REJECTED ToolError.
transfer.send json
{
  "agentId": "<agent-id>",
  "to": "0xRandomAddress",
  "amount": "15"
}

Conclusion

By setting an on-chain policy, you guarantee that the agent cannot exceed its bounds, leveraging MAWS's dual-track enforcement model.
Source: maroo-agents
ESC
Type to search