Policy Template
DAILY SPENDING LIMIT POLICY
The most fundamental guard against runaway agent spending. Cap total outflow within a rolling time window.
WHAT THIS POLICY DOES
A daily spending limit policy tracks the total value of all transactions executed by an agent within a rolling time window (default: 24 hours). When the cumulative spending reaches the cap, all further transactions are blocked until the window resets.
This is your safety net of last resort. Even if other policies (per-transaction caps, whitelists) have gaps, the daily limit ensures maximum exposure is bounded.
WHEN TO USE IT
- Every production agent — This should be on every agent as a baseline, regardless of other policies
- DeFi trading agents — Cap total daily trading volume to prevent runaway loops
- Payment agents — Limit how much an agent can disburse in a day
- Testing and staging — Set a low daily limit ($10-$100) during development
CONFIGURATION
{
"type": "daily-spending-limit",
"maxAmount": "1000.00",
"denomination": "USD",
"window": "24h",
"tokens": ["ETH", "USDC", "USDT"],
"chains": ["ethereum", "base"],
"action": "block",
"alert": {
"threshold": 0.8,
"webhook": "https://your-api.com/alerts"
}
} FIELD REFERENCE
type string Policy rule type identifier. Must be 'daily-spending-limit'.
Allowed values: daily-spending-limit
maxAmount string Maximum total spending allowed within the window. String to avoid floating-point precision issues.
denomination enum Currency for the limit. 'USD' uses real-time price feeds. Token names use raw token amounts.
Allowed values: USD, EUR, ETH, USDC, USDT, or any supported token
window string Rolling time window for the limit. Resets continuously (not at midnight).
Allowed values: 1h, 6h, 12h, 24h, 7d, 30d
tokens array Which tokens count toward this limit. Omit to include all tokens.
chains array Which chains this limit applies to. Omit for all chains. Spending is aggregated across specified chains.
action enum What happens when the limit is hit.
Allowed values: block (reject transaction), alert (allow but notify), queue (hold for manual approval)
alert.threshold number Percentage of limit (0-1) at which to trigger an early warning. 0.8 = alert at 80% spend.
alert.webhook string URL to POST alert payloads when threshold is crossed or limit is hit.
HOW IT WORKS
When a transaction is submitted:
- PolicyLayer looks up all transactions in the current rolling window
- Sums their values in the configured denomination (using real-time price feeds for USD)
- Adds the pending transaction's value to the running total
- If the total exceeds
maxAmount, the transaction is blocked and aPolicyViolationErroris returned - If an alert threshold is configured and crossed, the webhook is fired (transaction still proceeds if under limit)
The window is rolling, not calendar-based. If you set 24h and your first transaction was at 2pm, the window runs from 2pm yesterday to now — not midnight to midnight.
All enforcement happens via PolicyLayer's Two-Gate system: the intent is fingerprinted with SHA-256 before signing (Gate 1), and the signed transaction is verified against the fingerprint before broadcast (Gate 2).
COMBINING WITH OTHER POLICIES
Daily spending limits work best when layered with other policies. Common combinations:
- + Per-Transaction Cap — Prevents any single large transaction, while daily limit caps cumulative exposure
- + Recipient Whitelist — Limits where funds can go, while daily limit caps how much
- + Frequency Limit — Prevents rapid-fire transactions that could hit the daily limit in seconds
COMMON MISTAKES
Setting the limit too high for testing
Use $10-$100 in development. You can always raise it. A $100K limit on a test agent is asking for trouble.
Using token denomination for multi-token agents
If your agent trades multiple tokens, use USD denomination so the limit aggregates correctly. A '1000 ETH' limit doesn't protect against spending $500K in USDC.
Forgetting cross-chain aggregation
If your agent operates on multiple chains, make sure the daily limit spans all of them. Otherwise, the agent could spend the limit on each chain independently.
Not setting an alert threshold
If you only find out when the limit is hit, it's too late to react. Set an 80% alert so you get advance warning.
RELATED
USE THIS TEMPLATE
Copy this policy into your PolicyLayer dashboard or create it via the SDK.