Skip to content
AgentGuard® Get free score Book a demo

In-process spend and policy library

Cap model spend inside your own app.

AgentGuard® SDK checks spend caps and policy rules in your process before a model call leaves your server, and writes signed local records.

Sample data. A spend guard around a model client blocks a call that would pass the daily cap and writes a signed local record.

Stop loops before the provider charges you

Wrap your provider client so policy runs in-process before dispatch. Set caps per call, minute, hour, day and month, each with hard block, model downgrade or shadow logging.

Cap windowsSample data
Per callPer minutePer hourPer dayPer month
BlockDowngradeShadow

Scope limits to any dimension

Build one policy scope from tenant, team, user, agent, task and provider keys. Error messages and blocked traces localize in English, Spanish and Portuguese.

Scope keysSample data
tenantteamuseragenttaskprovider
en-USes-419pt-BR

Signed local records you can check offline

Add Ed25519 keys to record every completed decision in a tamper-evident local log. Verify records offline or in the browser at /verify with no account.

Local recordReal demo receipt
"action": "block","reasons": ["Cap 'per_day=50000c' exceeded"],"triggeredScopeKey": "tenantId=demo|agentId=agent-finance-bot-v3","signature": "bd53625d...0c3f06"# the demo receipt at /verify (Load demo)

Drops into Node.js and Python

Published for Node.js (@agentguard-run/spend) and Python (agentguard-spend), with bindings for OpenAI-compatible clients, Anthropic Messages, Bedrock, Vercel AI SDK, LangChain.js and OpenRouter.

Install
npm install @agentguard-run/spend

How it works

01Install the packagenpm install @agentguard-run/spend or pip install agentguard-spend.
02Wrap your clientSet spend windows, scope keys and an optional Ed25519 key.
03Enforce and verifyCalls stay inside budget in-process and records verify at /verify.
Free to install

Published on npm and PyPI.

Install and test free with no account.

Copy npm install

Questions

Does AgentGuard® SDK proxy my model traffic?

No. Policy checks run inside your own process before the request leaves your server.

How is this different from AgentGuard® Local?

AgentGuard® Local caps Claude Code and Codex through hooks; AgentGuard® SDK caps model calls inside apps you build.

Can I log before blocking?

Yes. Set any cap window to shadow mode to log decisions without blocking calls.

Live packages published on npm (@agentguard-run/spend 0.22.0) and PyPI (agentguard-spend 0.16.0).

Put spend limits right beside your model calls.