Skip to content
Discussion options

You must be logged in to vote

Define a risk tier in the policy engine and wrap the tool with guardTool. A call that is permitted but lands in an approval tier becomes escalate: the tool does not run, an approval request opens, and the guard throws ToolApprovalRequiredError with the request id and tier. After a human approves, retry with that id. The engine checks it and spends it once.

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 }) },
);

T…

Replies: 1 comment

Comment options

thegdsks
Oct 17, 2026
Maintainer Author

You must be logged in to vote
0 replies
Answer selected by thegdsks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant