Spending Controls
@agorio/plugin-spending-controls enforces spend limits before money moves. It hooks
onBeforeToolCall and blocks any checkout that would exceed a configured limit.
Limits
- Per-transaction — cap the value of a single checkout.
- Per-session — cap cumulative spend within one agent run.
- Daily — cap cumulative spend across a rolling day.
import { spendingControls } from '@agorio/plugin-spending-controls';
const agent = new ShoppingAgent({
llm,
plugins: [
spendingControls({
perTransaction: 50000, // amounts in minor units (e.g. cents)
perSession: 200000,
daily: 1000000,
}),
],
});When a tool call would breach a limit, the plugin stops it in onBeforeToolCall and the agent
surfaces the block rather than completing the purchase. It’s MIT-licensed and published as
@agorio/plugin-spending-controls.