Back to catalog / Agent workflows
Cap session spend and resume safely
Bound the cost of an unattended research session, inspect state at the cap, and resume only when authorized.
Goal
Goal: Bound the cost of an unattended research session, inspect state at the cap, and resume only when authorized.
Steps
- Set
budget={"type":"limit","max_list_cost":{"currency":"USD","amount":"10"}}when creating the session. [budget] - Monitor spend from
session.usage; onbudget_reached, stop automatic submissions and inspect session state and events. [budget] - After human approval, resume with
sessions.update(session_id, budget={...higher cap...}); verify output and archive. [budget]
How to verify
At the cap, verify the session is idle with recorded `list_cost`; after raising the budget, the same session resumes.
Troubleshooting
A request can finish slightly above the cap; a new cap cannot be below spend, so inspect `usage.list_cost` first.
Permissions
Prerequisites
- Python 3.11+, Anthropic API key, Managed Agents beta header, and a budget approval policy.
Permissions
- Require authorization to raise caps; test with a small limit and restrict external search tools.
Limitations
The cap applies to one session, not workspace/org quotas; the request crossing the limit can cause slight overage.
Pinned upstream source
- Repository
- anthropics/anthropic-cookbook
- File path
- managed_agents/CMA_cap_session_spend.ipynb
- Pinned commit
9c1e493ddd2b82df399d2a61b9c806c539e18be6- Source checked
- 2026-10-14 · Reviewed against the pinned upstream source
Repository metrics
These values describe the upstream repository, not popularity or likes for an individual skill or playbook.
- Stars
- Not collected
- Forks
- Not collected
- Observed at
- Not collected
No metrics snapshot is available yet.
License: MIT
Main topic
Turn ecommerce campaign materials into a reviewable weekly brief