Spend Control for Pydantic AI
Pydantic AI agents are structured, typed, and production-minded — which makes them perfect for a typed spend guard. Add sipi.bot as a tool and every agent gets a spending policy it can't override.
Why Pydantic AI agents overspend
Agents with tool access can call paid endpoints as part of their loop.
Retry and reflection loops multiply tool calls — and spend — without a cap.
There's no built-in budget concept in the agent runtime.
How it works
Register sipi.bot as a tool. Before spending, the agent calls it with amount, merchant, and category and receives a typed decision.
Rules that fit Pydantic AI workloads
Per-transaction cap for tool-call purchases.
Merchant allowlist for known paid tools.
Velocity limit so reflection loops can't compound.
Tool registration
from pydantic_ai import Agent
from sipi_guard import sipi_guard
agent = Agent("claude-sonnet-4-5", tools=[sipi_guard])
# Inside a tool that spends:
# decision = await sipi_guard(amount=800, merchant="api.vendor.com", category="api")
The agent asks before it spends. The answer is deterministic.
FAQ
Is there a Python SDK?
Yes — sipi.bot exposes a plain HTTP API, a CLI, and an MCP tool, and client wrappers for LangChain, CrewAI, the OpenAI Agents SDK, and the Vercel AI SDK take a few lines each.
Does the guard run a model?
No — the decision path is a deterministic rules engine. No model call, ~5 ms.
Can typed schemas be enforced?
The decision response is a typed object (decision, reason, rule_id, transaction_id), which fits Pydantic validation naturally.
Related
Stop the next $12,400 night.
One API call (or MCP tool) in front of every agent transaction — APPROVED, BLOCKED, or FLAGGED, deterministic, ~5 ms, fully logged.
See plans — from $99/mo Try a live check