Skip to main content
The Universal Action Policy provides granular control over function parameters. Use it when your agent handles funds and you need spending limits, recipient whitelisting, or parameter validation.

When to Use Universal Action

Agent handles user funds
Need per-action spending limits
Need cumulative spending caps
Want to restrict recipients
Need parameter validation

Core Concepts

Parameter Rules

Each rule validates one parameter in the function call and maximum of 16 rules can be added per policy.

Conditions

Trading Agent Example

Limit per-trade and max spending limit per session:

Payment Agent Example

Fixed recipient and amount:

Rebalancing Agent Example

Limit rebalance size to % of portfolio:

Per-Action vs Cumulative Limits

Per-Action Only

Each individual action must be ≤ limit, but no cumulative tracking:

Cumulative Tracking

Track total spent across all actions:

Multiple Rules Example

Validate multiple parameters:

Finding Parameter Positions:

For a function like swap(address tokenIn, address tokenOut, uint256 amount):
For structs, calldataArguments are more complex. Check the ABI encoding.

Common Patterns

Whitelist Single Recipient

Cap Per Transaction Amount

Total Max Spending Limit

Minimum Amount

Debugging Tips

  1. Check offsets: Use console.log(encodeFunctionData(...)) to see actual calldata
  2. Match decimals: USDC = 6, ETH = 18, etc.
  3. Test on testnet: Verify rules work before mainnet