Testing Spending Policies
This guide walks through setting up an agent from scratch and testing that spending policies enforce correctly. By the end, you’ll have an agent with policies that approve, require approval, or deny payments based on amount thresholds.Prerequisites
What You’ll Build
| Amount Range | Expected Result | Policy |
|---|---|---|
| 10 | Approved automatically | Under all thresholds |
| 15 | Requires approval | Exceeds approval threshold |
| $15+ | Denied | Exceeds max transaction amount |
Step 1: Create a Wallet
Configure the wallet
- Name: e.g., “Test Operations Wallet”
- Custody Type: PRIVY (recommended - enterprise-grade key management)
- Chain Type: EVM
Provision the wallet
Click Provision to assign an on-chain address. Your wallet is now ready to receive funds.
Step 2: Create an Agent
Set agent details
- Name: e.g., “Policy Test Agent”
- Agent Type: Choose your framework (select CUSTOM if unsure)
Link a funding wallet
In Step 2 of the wizard, select the wallet you created and configure spending limits:
| Setting | Value |
|---|---|
| Delegation Type | Limited |
| Per Transaction | 200 |
| Daily Limit | 1000 |
| Weekly Limit | 5000 |
| Monthly Limit | 20000 |
Step 3: Generate an SDK Key
Step 4: Create Policies
Create two policies to test different enforcement behaviors.Policy A: Spend Limit
Create the policy
Go to Policies in the sidebar and click Create Policy.
- Name: “Manual Spend Test”
- Description: “Deny transactions over $15”
- Policy Type: SPEND_LIMIT
Policy B: Approval Threshold
Create the policy
- Name: “Manual Approval Test”
- Description: “Require approval for transactions over $10”
- Policy Type: APPROVAL_THRESHOLD
Step 5: Assign Policies to the Agent
Step 6: Run Test Transactions
Usecurl or any HTTP client to test the three scenarios.
Test 1: $5 Payment (Expect: APPROVED)
Test 2: $12 Payment (Expect: REQUIRES_APPROVAL)
Test 3: $20 Payment (Expect: DENIED)
Step 7: Execute an Approved Payment
If Test 1 returnedAPPROVED, you can execute it on-chain:
txHash and an explorer URL to verify on-chain.
Using the SDK Instead of curl
The same tests using the TypeScript SDK:Editing Wallet Limits After Setup
If you need to change wallet spending limits after the initial setup:- Go to the agent detail page
- Open the Overview or Wallets tab
- Click the pencil icon next to the wallet
- Update per-transaction, daily, weekly, or monthly limits
- Click Save Changes
How Policy Evaluation Works
When a payment request comes in, Conto evaluates in this order:- Wallet-level limits — per-transaction, daily, weekly, monthly caps set on the agent-wallet link
- Policy rules — all assigned policies are evaluated with AND logic
- First DENY stops — if any rule denies, the request is immediately denied
- REQUIRE_APPROVAL — if any rule requires approval, the request is held for manual review
- All pass — if everything passes, the request is approved
Organization-level policies (assigned to the org, not directly to the agent) also apply. These stack with agent-level policies. Check the Permissions tab on the agent detail page to see all effective policies.
Troubleshooting
All payments denied with 'per-transaction limit of $0'
All payments denied with 'per-transaction limit of $0'
The wallet-level per-transaction limit is set to
0. Edit the wallet limits on the agent detail page (pencil icon) and set it to a non-zero value.Payment denied but I expected REQUIRES_APPROVAL
Payment denied but I expected REQUIRES_APPROVAL
Multiple policies are evaluated with AND logic. If one policy denies while another would require approval, the denial takes priority. Check which policies are assigned in the Permissions tab.
Wrong policy is triggering
Wrong policy is triggering
Policies at the same priority level are all evaluated. If your approval threshold (
>$10) fires before your spend limit (>$15), it’s because the approval threshold is checked first. Both are still enforced — the most restrictive outcome wins.SDK key returns AUTH_FAILED
SDK key returns AUTH_FAILED
SDK keys are only shown once when generated. If you’ve lost it, generate a new one from the agent detail page under SDK Integration.
Organization policies are overriding my agent policies
Organization policies are overriding my agent policies
Org-level policies apply to all agents. If a Starter policy caps transactions at 100, the $25 cap wins. Check with your org admin.