The whole hunk
from line 14, old and new numbered
/
lines
from line 14
1414
1515Pass the optional `budget` field when you create the session:
1616
17<CodeGroup defaultLanguage="CLI">
17<CodeGroup>
1818 ```bash cURL
19 session=$(curl -sS --fail-with-body https://api.anthropic.com/v1/sessions \
19 curl -sS --fail-with-body https://api.anthropic.com/v1/sessions \
2020 -H "x-api-key: $ANTHROPIC_API_KEY" \
2121 -H "anthropic-version: 2023-06-01" \
2222 -H "anthropic-beta: managed-agents-2026-04-01" \
from line 31
3131 }
3232 }
3333 EOF
34 )
35 SESSION_ID=$(jq -r '.id' <<< "$session")
3634 ```
3735
3836 ```bash CLI
3937 # Keep the amount quoted so it is sent as a string, not a number.
40 SESSION_ID=$(ant beta:sessions create \
38 ant beta:sessions create \
4139 --agent "$AGENT_ID" \
4240 --environment-id "$ENVIRONMENT_ID" \
43 --budget '{type: limit, max_list_cost: {amount: "125", currency: USD}}' \
44 --transform id --raw-output)
41 --budget '{type: limit, max_list_cost: {amount: "125", currency: USD}}'
4542 ```
4643
4744 ```python Python
from line 191
194191
195192Update the session with a new `max_list_cost`. The new value can be higher or lower than the current cap, but it must be strictly greater than the session's consumed list cost; otherwise the update is rejected with a 400 error: `budget.max_list_cost must be greater than the session's consumed list cost`. Because the consumed cost usually sits [a fraction past the old cap](https://platform.claude.com/docs/en/managed-agents/budgets#when-a-session-reaches-its-budget) when the session pauses, base the new value on the session's reported `usage.list_cost`, not on the old `max_list_cost`. Set it a cent or more above that figure: the reported value is rounded and can sit a fraction below the exact consumed cost the check uses.
196193
197<CodeGroup defaultLanguage="CLI">
194<CodeGroup>
198195 ```bash cURL
199196 curl -sS --fail-with-body "https://api.anthropic.com/v1/sessions/$SESSION_ID" \
200197 -H "x-api-key: $ANTHROPIC_API_KEY" \
from line 301
304301
305302Set `budget` to `null` to remove the cap entirely. The session's paused work resumes, and the resulting `session.updated` event carries `budget` set to `null`.
306303
307<CodeGroup defaultLanguage="CLI">
304<CodeGroup>
308305 ```bash cURL
309306 curl -sS --fail-with-body "https://api.anthropic.com/v1/sessions/$SESSION_ID" \
310307 -H "x-api-key: $ANTHROPIC_API_KEY" \