Guide/governance2 min read

How to Set a Budget Cap on an AI Agent

How to set a budget cap on an AI agent: combine agent-profile budget with Account Kit card limits so spend is enforced server-side, not in the prompt.

Read the docs →

Guide/governance
TL;DR
  • A budget cap on an AI agent must be enforced at execution time telling the model a dollar limit in the prompt is not a cap.
  • Naïve applies caps at two layers: agent-profile budget (hard/soft) and per-primitive defaults in the Account Kit.
  • Hard caps reserve atomically and return budget_exceeded when exhausted; soft caps route to the approvals queue.
  • Card spending limits are set in cents on the kit prepaid gift cards support a published $150 maximum (per published docs).
  • Scope caps per tenant user with forUser(id) so one customer's overrun never touches another's budget.
  • Combine profile budget + card limit + approval gates for defense in depth.

Telling an agent "don't spend more than $50" in the system prompt is not a budget cap — it is a suggestion the model can ignore, misread, or be tricked into overriding. A real cap is enforced before money moves, on every call.

This how-to shows the Naïve pattern: agent-profile budget plus Account Kit defaults. For the full governance story, read spend caps, approvals, and revocation.

Step 1 — Scope to one tenant user

Budget caps attach to an agent identity. Create or resolve the tenant user first:

const user = await naive.users.create({ email: "customer@acme.com" });
const scoped = naive.forUser(user.id);

Step 2 — Set card defaults on the Account Kit

Put the per-card ceiling in the kit's primitives_config.cards defaults:

await naive.accountKits.update(kitId, {
  primitives_config: {
    cards: {
      enabled: true,
      spending_limit_cents: 5000, // $50.00 per card
    },
  },
});

Every card the agent issues for users on this kit inherits the limit. Prepaid gift cards support a published $150 maximum (per published docs).

Step 3 — Set the agent-profile budget cap

The combined cost ceiling lives on the agent profile in your IaC config and is enforced at the governance gateway. Set limits.budget on the agent blueprint in naive.config.ts:

// naive.config.ts
import { defineConfig, agent, identity, skills } from "@usenaive-sdk/iac";
 
export default defineConfig({
  agents: {
    "travel-agent": agent({
      is: identity.agent(),
      can: [skills.llm, skills.search],
      limits: {
        budget: "$100/mo", // combined cap — alerts at 80%, hard-denies at cap
      },
    }),
  },
});

Apply with naive up. The cap sums every metered action (LLM, search, compute, hosted runtime, card spend) over the window and reserves atomically under a lock — an over-budget action returns 403 budget_exceeded. Use a soft cap if over-threshold spend should route to human approval instead.

Step 4 — Run a gated action and confirm enforcement

Issue a card or attempt a charge through the governed tool path. Confirm:

  1. Under the cap → executes (or 202 if approval-gated)
  2. Over the hard cap → budget_exceeded
  3. Activity log shows the attempt under the correct tenant user

Step 5 — Layer approvals for irreversible spend

Caps limit volume; approvals gate sensitivity. Cards default to requiring approval for agent calls (per published docs) — combine both so a large spend within cap still waits for a human when policy demands it.

Where to go next

Frequently Asked Questions
How do I set a spending limit on an AI agent?+
Set a combined budget on the agent profile and per-primitive limits in the Account Kit. On Naïve, create or update the agent profile with a budget object — hard caps block execution when exhausted; soft caps enqueue an approval instead. For card spend specifically, set spending_limit_cents in the kit's cards primitive config so every card issued under that user inherits the ceiling.
What is the difference between a hard and soft budget cap?+
A hard cap reserves budget atomically before execution. When it is exhausted, the gateway returns budget_exceeded and the action never runs. A soft cap still allows the action to be attempted but routes it to the human approvals queue (HTTP 202 pending_approval) so a person can decide whether to spend over the threshold.
Can the AI agent raise its own spending limit?+
No — when caps are enforced server-side on the governance gateway, the model cannot edit Account Kit config or agent profile budget through tool calls. A prompt instruction to 'increase your limit' has no effect; only your server-side code or dashboard can change policy.
Where do card spending limits come from?+
From the Account Kit assigned to the tenant user. The cards primitive accepts defaults such as spending_limit_cents. Each virtual card issued for that user inherits the kit ceiling. Prepaid gift cards support a published $150 maximum (per published docs).
Do budget caps work per customer in a multi-tenant app?+
Yes. Budget and kit assignment are per tenant user. Customer A's agent profile budget and card limits are independent of Customer B's — scope every provisioning call with naive.forUser(customerId).
What happens when an agent hits the cap mid-run?+
The regulated tool call fails at the gateway with budget_exceeded (hard cap) or pending_approval (soft cap). The agent loop receives the error like any other tool failure; your orchestrator can retry, escalate to a human, or stop. Earlier successful calls in the same run remain in the audit log.
NT
Naïve Team

Building the agent-native backend.

Keep reading