Skip to main content
PUT
Set a session's budget

Authorizations

Authorization
string
header
required

A Recursion API key, created in the console under API keys.

Headers

Idempotency-Key
string

Replay-protection key in an organization-wide namespace shared by keyed mutations. It must contain 1 to 256 visible ASCII characters and be sent as exactly one header value. Request identity is the exact HTTP method, escaped path, raw query, and raw body bytes. For the legacy automation-run route only, the historical fingerprint ignores top-level JSON formatting and object-key order and removes the retired top-level idempotency_key field. The same request replays the original successful response; any different request returns 409 idempotency_conflict, and an active matching request returns 409 idempotency_in_progress. Completed receipts are retained for approximately 24 hours, pending claims may be reclaimed after approximately 1 hour, and no deduplication is guaranteed after expiry.

Required string length: 1 - 256
Pattern: ^[!-~]+$
x-tenant-id
string

Optional tenant consistency check. When present, it must name the tenant bound to the API key, including when x-organization-id is default.

Minimum string length: 1
x-organization-id
string

Organization in which to act. Required for a tenant-scoped API key. Optional for an organization-scoped key, where it must name that same organization. The value may be an organization id or default.

Minimum string length: 1

Path Parameters

sessionId
string<uuid>
required

Session id (UUID) as returned by managedAgentsStartSession or managedAgentsListSessions.

Body

application/json

The most a session and its threads may spend, in US dollars at the billed price, counting model requests, tools and sandbox compute. On Recursion, linked outcome grading sessions count toward the writer's budget when they share that budget. Reaching it pauses the session with stop_reason budget_reached before its next paid request; raising or removing the budget continues it.

maxCostUsd
string
required

The budget in US dollars, as a decimal string with at most two decimals, such as "10" or "12.50". Between 0.01 and 100000.

Pattern: ^(0|[1-9][0-9]{0,5})(\.[0-9]{1,2})?$
Example:

"10.00"

Response

A session tree's budget and what it has spent toward it.

A session tree's budget and what it has spent toward it.

continuesOnRaise
boolean
required
read-only

Whether raising or removing the budget of a session paused at it continues the session right away. False for a session bound to a Slack thread, which continues on its next reply there.

maxCostUsd
string
required

The budget in US dollars, with two decimals.

Pattern: ^(0|[1-9][0-9]{0,5})(\.[0-9]{1,2})?$
Example:

"10.00"

agentCapUsd
string
read-only

The agent's multiagent.limits.max_tree_cost_usd, in US dollars with two decimals: the most this budget can be set to. A session whose budget reached it stays paused; start a new session, or raise the agent's cap for sessions started after.

Example:

"25.00"

spentUsd
string
read-only

What the session tree has spent, plus any linked outcome grading sessions charged to the same budget on Recursion, in US dollars with two decimals, at the billed price the budget is enforced at (models, tools and sandbox compute). Present on a full read of the root; absent when the spend could not be read. A session that paused at its budget can read a little past it: the request that crossed it completes.

Example:

"4.20"