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 onchain address. Your wallet is now ready to receive funds.
Step 2: Connect 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
Add a rule
| Field | Value |
|---|---|
| Rule Type | MAX_AMOUNT |
| Operator | LTE |
| Value | 15 |
| Action | ALLOW |
How rule actions work:
ALLOW+LTE $15means: “Allow transactions where the amount is ≤ $15”- Transactions that do NOT match the ALLOW condition are implicitly denied
DENY+GT $15achieves the same effect: “Deny transactions where amount > $15”REQUIRE_APPROVAL+GT $10means: “Require manual approval when amount > $10”
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.
Verify Your Setup
Before running test transactions, verify your agent is correctly configured:agent.statusis"ACTIVE"walletsarray is not emptypoliciesshows your assigned policies
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 onchain:
txHash and an explorer URL to verify onchain.
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
Conto evaluates wallet-level limits first, then policy rules with AND logic. The first DENY stops evaluation. Org-level policies stack with agent-level policies. See Policy Overview for the full reference.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.
Next Steps
Policy Types
Explore all available policy rule types
SDK Reference
Full SDK payment methods and options
Time Windows
Restrict payments to specific hours and days
Counterparties
Allowlist and blocklist recipient addresses