Budgets
Budgets enforce spending limits at any level of your agent hierarchy. Each budget has an amount, a period (daily/weekly/monthly/total), and tracks spend in real time.Hierarchical budgets
Budgets can have parent budgets viaparent_budget_id. When a card is created against a budget, the entire chain is validated and debited atomically:
- Walk up the parent chain (max depth 10)
- Lock each budget row with
FOR UPDATE - If any level has insufficient remaining balance → deny with bottleneck message
- If all levels pass → debit all in a single pass
Budget periods
Delegation rules
Delegation rules control which agents can create cards on behalf of other agents within an organization.Enforcement
When a delegated agent creates a card:- System finds delegation rules where the agent is the delegate
- Checks
max_amount_cents— denies if exceeded - Checks
allowed_categories— denies if merchant category not in list - If
requires_approval: true— forces approval even if rules say auto-approve
Agent hierarchy
Agents support parent-child relationships viaparent_agent_id. Combined with budgets and delegation, this enables:
- Department-level budget caps
- Per-agent spending limits within departments
- Delegated authority with category restrictions