Repository navigation
|
My billing agent may call a pay tool, but a person should sign off on anything over a threshold, and the approval should work once, not as a standing pass. |
Replies: 1 comment
|
Define a risk tier in the policy engine and wrap the tool with policy: {
risk: { tiers: [{ tier: "large", when: { minAmount: 1000 }, require: "approval" }] },
},
// ...
const pay = guardTool(
theauth,
{ agentId: agent.id, risk: (args: { amount: number }) => ({ amount: args.amount, currency: "USD" }) },
{ name: "pay", execute: async (args: { amount: number }) => ({ paid: args.amount }) },
);The retry passes Limits:
Docs: docs/approval.mdx, docs/agent-tools.mdx, docs/policy-engine.mdx. |
Define a risk tier in the policy engine and wrap the tool with
guardTool. A call that is permitted but lands in anapprovaltier becomesescalate: the tool does not run, an approval request opens, and the guard throwsToolApprovalRequiredErrorwith the request id and tier. After a human approves, retry with that id. The engine checks it and spends it once.T…