Policy types
| Policy | What it enforces |
|---|---|
| allowed_contracts | Agent can only interact with whitelisted contract addresses |
| allowed_functions | Agent can only call whitelisted function selectors |
| spending_limit | Rolling, time-windowed cap per token (e.g., 1000 USDC per day) |
| rate_limit | Max transactions per time window, tracked across sessions |
| expires_at | Hard expiry - the policy stops working after this timestamp |
| custom | Pluggable policy contracts for specialized logic (e.g., max slippage on swaps) |
How policies are evaluated
Before every transaction, the FunctorPolicyHook runs all policies attached to the signing key. Every policy must pass. Any single failure reverts the transaction.Rolling time-windowed limits
This is where Functor differs from existing session key modules. Existing tools offer lifetime spending caps - once the limit is hit, the session is dead. The developer must create a new session. There is no “1000 USDC per day that resets tomorrow.” Functor tracks spending per time window. When the window rolls over, the counter resets:| Time | Spent today | Limit | Action |
|---|---|---|---|
| 9:00 AM | 0 USDC | 1000/day | Agent sends 400 USDC - allowed |
| 2:00 PM | 400 USDC | 1000/day | Agent sends 500 USDC - allowed (900 total) |
| 5:00 PM | 900 USDC | 1000/day | Agent sends 200 USDC - blocked (would exceed 1000) |
| Next day | 0 USDC | 1000/day | Counter resets. Agent can spend again. |