Give an Agent a Spending Limit
Define a policy in plain English. Brain enforces it on every proposed action.
The Simplest Policy
const policy = await brain.policy.compose("acme", {
text:
"Allow invoice payments under $5,000 to approved vendors. " +
"Require CFO approval above $5,000. " +
"Block payments to new counterparties without review.",
});
await brain.policy.sign(policy.id);Reviewing What Got Compiled
console.log(policy.explanation);
// This policy will:
// - Auto-approve payments under $5,000 to vendors marked as approved
// - Escalate payments at or above $5,000 to anyone with the CFO role
// - Reject all payments to counterparties not yet on the approved list
console.log(policy.rules);
// [
// { if: "amount < 5000 && counterparty.known", then: "auto" },
// { if: "amount >= 5000 && counterparty.known", then: "needs_approval", approvers: ["role:cfo"] },
// { if: "!counterparty.known", then: "rejected", reason: "new_counterparty_review_required" }
// ]Trying It Before You Ship It
Approvers
Reference
Matches
Approving Counterparties
Multiple Environments
Environment
Policy approach
Updating a Policy
What Policy Can Express
Concept
Example
What Policy Can't Express in Plain English (Yet)
What's Next
Last updated
