spendguard-strict-budget-runner
Original:🇺🇸 English
Translated
1 scriptsChecked / no sensitive code detected
Run application agents through SpendGuard with strict hard budget caps. Use when setting up `spendguard-sidecar`, creating agent IDs, setting or topping budgets, sending OpenAI/Grok/Gemini/Anthropic calls through SpendGuard endpoints, and troubleshooting budget enforcement errors like insufficient budget, in-flight lock conflicts, missing `x-cynsta-agent-id`, or remote pricing signature failures.
10installs
Added on
NPX Install
npx skill4agent add cynsta-technologies/spendguard-sdk spendguard-strict-budget-runnerTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →SpendGuard Strict Budget Runner
Overview
Use this skill to operationalize strict-budget execution.
Quick Start
- Load .
references/strict-budget-quickstart.md - Start sidecar in strict remote-pricing mode.
- Create agent and set hard budget with CLI or .
scripts/bootstrap_strict_budget.py - Route model calls through SpendGuard and include required headers.
- Confirm budget decrement and handle failures using .
references/error-playbook.md
Workflow
1) Start SpendGuard in strict mode
Use sidecar mode with remote signed pricing verification enabled. Do not bypass signature checks for normal usage.
See full env setup in .
references/strict-budget-quickstart.md2) Create budgeted agent identity
Prefer CLI:
bash
spendguard agent create --name "my-agent"
spendguard budget set --agent <agent_id> --limit 5000 --topup 5000
spendguard budget get --agent <agent_id>Use script when deterministic JSON output is needed:
bash
python scripts/bootstrap_strict_budget.py --name my-agent --limit 5000 --topup 50003) Route model calls through SpendGuard
Send requests to sidecar routes, not directly to provider APIs.
.../v1/...Required:
- Header
x-cynsta-agent-id: <agent_id> - Optional for explicit run tracking
x-cynsta-run-id: <run_id>
Load for OpenAI SDK and direct HTTP patterns.
references/routing-patterns.md4) Enforce strict budget behavior
Expect:
- when budget is insufficient for reserve
402 - when same agent budget is locked by another in-flight run
409 - for malformed payload or missing required headers
400
Apply fixes from .
references/error-playbook.md5) Validate before finishing
Run these checks after setup:
- Health endpoint returns .
{"status":"ok"} - returns expected
budget get.remaining_cents - One real or mocked model call succeeds through sidecar.
- Remaining budget decreases after settled usage.
Guardrails
- Use one agent per isolated budget domain; do not share agent IDs across unrelated workloads.
- Keep budgets in cents and treat as the strict cap.
hard_limit_cents - Keep in normal operation.
CAP_PRICING_VERIFY_SIGNATURE=true - In hosted mode, pass API key via or
--api-key.CAP_API_KEY