Skip to content

Capabilities

One policy and one configured scope per guard. All policy evaluation runs in process. With signing keys configured, decisions are Ed25519-signed and SHA-256 hash-chained over deterministic key-sorted JSON.

Capability What you get
Cap windows per_call, per_minute, per_hour, per_day, per_month. Any combination; each window has independent state. One policy can carry a per-minute burst guard, a daily soft cap and a monthly ceiling at once.
Cap actions allow passes and logs. shadow passes and records the decision. downgrade rewrites the model parameter to a cheaper model, then proceeds. block raises AgentGuardBlockedError before the provider is contacted.
Scope dimensions tenant, team, user, agent, task, provider. These form one collision-resistant scope key. Within one policy, the most restrictive action among exceeded caps wins.
Capability gating read_only, data_write, payment_initiate, payment_execute. A policy can require a minimum tier; calls without a sufficient capabilityClaim are blocked before dispatch. Claims are caller-supplied unless the policy also requires a verified receipt-DAG attestation.
Localization en-US, es-419, pt-BR. Block traces auto-detect the locale via AGENTGUARD_LOCALE, LC_ALL or the system locale. Override with locale="es-419".
Verification With config.signingKeys, each decision produces an Ed25519-signed entry. Anyone with the public key can verify without AgentGuard infrastructure. Without keys, enforcement still runs and the signed entry is null.
Audit Entries are SHA-256 hash-chained. Tampering with any field invalidates the chain from that point forward. In-memory and NDJSON stores are exported; implement DecisionLogStore for other storage.
Provider portability OpenAI, Anthropic and Bedrock native interfaces. The OpenAI binding also wraps compatible chat.completions.create clients, including OpenRouter-style endpoints.
Terminal window
npm install -g @agentguard-run/spend
agentguard demo
agentguard verify
import OpenAI from 'openai';
import { withSpendGuard } from '@agentguard-run/spend';
const client = withSpendGuard(new OpenAI(), {
policy,
scope: { tenantId: 'acme', agentId: 'agent-1' },
config: { signingKeys, logStore },
});
Command What it does
agentguard demo Deterministic simulation that produces a real Ed25519 signature over real canonical JSON. No network calls.
agentguard verify Verifies a signed receipt’s signature, entry hash and chain link.
agentguard init Scaffolds agentguard.policy.yaml and agentguard_quickstart.ts, adds .agentguard/ to .gitignore. Existing files are preserved unless you opt into overwrite.
agentguard doctor Health check: crypto backend, provider SDK detection, keypair directory writable, policy file present, dry-run block simulation.
agentguard explain <receipt> Pretty-prints a receipt: action, cap math step by step, what would unblock and when, signature breakdown.