Cap Agent Spend and Require Human Approval
Описание и применение
Руководство демонстрирует, как ограничить расходы агентов и требовать человеческого одобрения, используя библиотеку TheAuth.
Задача
Agent fleets can spend money without knowing the difference between valid credentials and affordable usage, leading to unexpected provider charges and uncontrolled destructive actions.
Результат
The guide demonstrates how to enforce spend caps and human approval in an agent fleet, preventing unexpected charges and destructive actions while maintaining auditability.
Рабочий процесс
- Create theAuth instance with SQLite and approval configuration
- Create a planner agent with broad permissions
- Create a summarizer agent with no permissions
- Delegate limited permissions from planner to summarizer using theauth.delegate()
- Implement budget policy checks with theauth.policies.checkBudget()
- Set up approval requests with theauth.approval.request()
- Record costs with costs.recordCost()
- Monitor alerts and cost reports
Доказательства
The system simply had no idea that "valid" and "affordable" are different questions.
This guide builds all three with theAuth, an open-source auth library for AI agents and humans ( @glinr/theauth on npm).
Notice the last column. Only delegation and permission constraints sit inside authorize(). Budgets and approvals are modules you call.
- Дата записи: 2026-10-10T22:42:10.388Z