{
 "schema": "aiblocks-page/1",
 "id": "execution-policies-and-budget-enforcement-implementation-planner",
 "type": "skill",
 "name": "Agent spending cap builder",
 "summary": "Plan hard spending caps for your AI agents. Hold cost before each call, stop at the limit and report real spend. Draft code only.",
 "headline": "Agent spending cap builder",
 "subhead": "Give it your agents, their daily and monthly caps and the time zone your day starts in. It reads a starter budget module and report queries, lists what they get wrong and plans the fix. You get a policy table, reserve and stop rules, reports and tests. Nothing is run.",
 "job": {
  "id": "build-software",
  "name": "Build and ship software"
 },
 "level": "intermediate",
 "thinking": "medium",
 "tested": true,
 "updated": "2026-11-03",
 "first_published": "2026-10-25",
 "inputs": [
  {
   "type": "codebase",
   "required": true,
   "label": "Codebase",
   "what": "a project's code, in a folder or repo the AI can open"
  }
 ],
 "outputs": [
  {
   "type": "code_change",
   "required": true,
   "label": "Code change",
   "what": "a change to the code, with what it fixes and how it was checked"
  }
 ],
 "you_give": [
  "Your agents, and what each one pays for, such as model calls or paid tools",
  "A daily and a monthly cap for each agent and one for the whole system, in one currency",
  "The time zone in which your day starts, so the daily cap resets at the right moment",
  "The provider's current prices, taken from its price page",
  "Who may raise a cap or restart a stopped agent",
  "Your current database tables for calls and limits (optional)"
 ],
 "you_get": [
  "A list of gaps in the starter files, each with a fix",
  "A policy table with the cap, warning level and hard stop for each agent",
  "Reserve-and-settle steps and the error each refusal returns",
  "Warning and hard-stop rules with an incident record",
  "Report views for spend by agent, job, client and model",
  "Test cases, including two calls at the same moment"
 ],
 "use_when": [
  "You run several AI agents and want a hard daily and monthly limit for each one.",
  "An agent got stuck in a loop, or you fear one will, and you want it stopped automatically.",
  "You want a report of spend by agent, by job and by client that you can check against the invoice.",
  "You have a starter budget module and need to know what it is missing before you rely on it."
 ],
 "skip_when": [
  "You want to record the tokens and cost of every AI call. Use the Agent AI cost tracker builder. This skill sets the limits.",
  "You want to plan who must approve an action, such as a refund or an email send. Use the Agent approval workflow builder.",
  "You have one script and one provider. Use the provider's own billing alert and budget cap instead.",
  "You want it to create tables or pause agents for you. It drafts the code and rules. You run them on a copy first."
 ],
 "output_sample": {
  "input": [
   "Your agents, and what each one pays for",
   "A daily and a monthly cap for each agent, and the time zone your day starts in",
   "The provider's current prices, and who may raise a cap or restart an agent"
  ],
  "prerequisites": [
   "An AI that can read your code files, or code pasted into the chat",
   "A database that stores AI calls, or the starter layout to build one"
  ],
  "output": [
   {
    "name": "Gaps in the starters",
    "contains": "What the starter budget code and report queries get wrong, why it matters and the fix for each."
   },
   {
    "name": "Policy matrix",
    "contains": "For each agent and action, the caps, the warning level, the hard stop and who can raise it."
   },
   {
    "name": "Reserve and settle",
    "contains": "The steps of one paid call, from holding the cost to settling the real one, with the error each returns."
   },
   {
    "name": "Warnings and hard stop",
    "contains": "What is recorded, who is told and what is blocked at each level, and who restarts the agent."
   },
   {
    "name": "Reports",
    "contains": "Five spend views, what each answers and the one meaning of a day they all use."
   },
   {
    "name": "Test cases",
    "contains": "Cases such as a call just over the cap, two calls at once and an agent with no cap."
   }
  ]
 },
 "output_shape": "BASIS\n<what was read; nothing was run>\nMISSING: <inputs and what each stops>\n\nGAPS IN THE STARTERS\n<#> | <what it does> | <why it matters> | <fix>\n\nPOLICY MATRIX\n<agent> | <action> | <daily cap> | <monthly cap> | <warn at> | <hard stop> | <who can raise> | <approval needed>\n\nRESERVE AND SETTLE\n<step> | <what happens> | <where in your code> | <error returned>\n\nWARNINGS AND HARD STOP\n<event> | <what is recorded> | <who is told> | <what is blocked> | <who restarts>\n\nREPORTS\n<view> | <question it answers> | <window used>\n\nTEST CASES\n<name> | <set-up> | <expected result>\n\nNEXT STEP\n<the smallest useful step>",
 "how_to_use": [
  "Open the skill in an AI that can read your code, such as Claude Code or Codex. A chat AI works if you paste the files in.",
  "Paste your agent list, caps, time zone and who may restart an agent. Get prices from each provider's price page. Never paste an API key.",
  "Read GAPS IN THE STARTERS first. Mark each one as a problem for you or not.",
  "Check the POLICY MATRIX against what you want. Check who can raise each cap and what happens at the limit.",
  "Run the draft code and the test cases on a copy of your database. This skill never runs anything.",
  "Compare one real day of report totals with the provider's invoice before you trust them."
 ],
 "checks": [],
 "next": [
  {
   "name": "Simple code coach",
   "url": "https://useaiblocks.com/skills/simple-code-coach",
   "why": "Build it"
  }
 ],
 "source": null,
 "credits": [],
 "files": [
  "references/budget-enforcer-starter.ts",
  "references/build-brief.md",
  "references/cost-tracker-dashboard-queries.sql",
  "references/method-notes.md"
 ],
 "links": {
  "page": "https://useaiblocks.com/skills/execution-policies-and-budget-enforcement-implementation-planner",
  "markdown": "https://useaiblocks.com/skills/execution-policies-and-budget-enforcement-implementation-planner.md",
  "json": "https://useaiblocks.com/skills/execution-policies-and-budget-enforcement-implementation-planner.json",
  "instructions": "https://useaiblocks.com/skills/execution-policies-and-budget-enforcement-implementation-planner/SKILL.md",
  "download": "https://useaiblocks.com/skills/execution-policies-and-budget-enforcement-implementation-planner.zip",
  "api_item": "https://useaiblocks.com/api/v1/items/execution-policies-and-budget-enforcement-implementation-planner",
  "api_document": "https://useaiblocks.com/api/v1/documents/skill/execution-policies-and-budget-enforcement-implementation-planner",
  "mcp": "https://useaiblocks.com/mcp"
 }
}
