You need an agent and an environment. If the environment has a setup script, it must have passed a current setup run. Starting, messaging, and stopping sessions needs the Developer or Admin role; the User role can list and read them. API calls use a key from API keys.
Start a session
Send the agent, the environment, and the task. Name the files you want back, so the agent saves them as deliverables.- Console
- cURL
- In the sidebar, click Sessions, then click Launch session.
- Under Configuration, select an Agent and an Environment.
- Under Task, write the Opening message: the task, the deliverables you want by name, and what done looks like.
- Optionally, choose vaults under Credentials, a mode under Team, and add Custom metadata.
- Click Launch session.
202 Accepted:
session_id. 202 means the session was accepted, not that it is running. status_path is relative to https://api.recursion.labelbox.com and already starts with /managed-agents, as does the Location response header.
The Idempotency-Key header is required. Use a value that identifies the work, such as a job id, and send it again on every retry: the same request with the same key returns the same session instead of starting a second one.
All start fields
All start fields
Retry a start safely
Retry a start safely
Keys share one namespace across keyed mutations in your organization, so include the operation and work identity. Completed receipts last about 24 hours, pending claims can be reclaimed after about 1 hour, and deduplication is not guaranteed after expiry. The session id is derived deterministically from the durable receipt, so an exact replay returns the same
session_id. See Idempotent mutations.Watch it work
Stream the session’s events to follow along as the agent works. The stream replays what already happened, then stays open for new events, and closes when the session reaches a terminal status.- Console
- cURL
Open the session from Sessions. The transcript updates live, and the status badge shows the current state.
data line carries the full event.
view=summary and stop on any terminal status, not only completed, and also when the session needs you.
What success means
When the agent loop finishes,status becomes completed whether or not the task succeeded. Read the final message and open the files it saved to judge the work.
When a session fails,
failure holds phase, code, message, retryable, category, and at. category is transient (retry), caller_error (fix the request or setup), or internal.
Deliverables appear in the session’s Files tab. Files the agent leaves elsewhere stay in /workspace for later turns, even after a stopped sandbox is released, and can be used when the workspace reopens successfully, but they aren’t captured as deliverables. Deleting the session removes access to its workspace. See Deliverables and artifacts and Download session deliverables. To give a session input files, attach them in Launch session, with resources at start, or in the session’s Files tab while it runs.
Read a session's details
Read a session's details
In Sessions, click a session. The Session tab shows its state, agent, environment, and Custom metadata. A session an automation started also shows Started by: the Automation, the Trigger that fired, and the Run, each linking back to the automation. See Automations.With the API,
view=full (the default) returns the whole session, including the agent and model snapshots and the resolved configuration. view=summary omits agent_snapshot, model_snapshot, and config, which makes polling cheaper. Any other view value returns 400.Continue the conversation
Send a follow-up to add to the task or ask for changes. A running session reads it at its next turn. An idle or finished root session picks the work up again. The full send options, including the delivery states in the response, are in Events.- Console
- cURL
Open the session, type in Message the agent…, and click Send. While the agent is working the button reads Queue.
409 conflict; message the root session instead.
To change direction mid-turn, interrupt instead:
- Interrupt stops the current model call and gives a running tool a short grace period to stop. The session waits, with its sandbox, for your next message.
- Interrupt and send stops the current turn and starts a new one with your message, in one call.
Interrupt, and interrupt and send
Interrupt, and interrupt and send
An interrupt stops the current model call right away and gives a running tool a short grace period to stop. If messages are queued, the newest starts a fresh turn. Otherwise the session stays The response is The response has the same shape as a send, with
active and goes idle with stop_reason: interrupted, ready for your next message. The sandbox stays up. In the console, click Interrupt under the last event while the agent is working.{ "interrupted": true }. A session with nothing running (idle and not sleeping or waiting on its subagents, or already finished) answers 409 conflict, and nothing is recorded. interrupted: false means the stop was recorded but reaching the running work was not confirmed, usually because the run ended as the request arrived.interruptAndSendSessionMessage stops the current turn and starts a fresh one with your message in one call. Send message for plain text, or content for content blocks; content wins if you send both. In the console, type your message and click Interrupt & send, which appears while the agent is working.events_accepted: 2: the interrupt and your message.Send an image
To show the agent a screenshot or chart, attach it to a message. The model sees the image when its model accepts images. In the session’s message box, click Attach image, choose the image, write your message, and click Send. To use an image from your library, click Attach from Files. Send PNG, JPEG, or WebP; the type is detected from the bytes. An image the session’s image limits refuse returns400 with the reason. See Limits.
Stop or delete a session
- Cancel
- Delete
{ "cancelled": true } and delete { "deleted": true }. You can cancel any session that is not completed, failed, or already cancelled, including an idle one. The cancel response is the same when the session was already finished, so it is safe to repeat. Sandbox teardown can finish shortly after the response.
Find sessions
listSessions returns sessions in your organization, most recently updated first. Filter by status, kind, agent, agent tags, or your metadata.
- Console
- cURL
In the sidebar, click Sessions. The Status, Agent, Agent tags, and Metadata filters cover every session. The search box matches id, agent, state, or metadata on the page shown; paste a full session id to find a session on any page. Click a column header to sort the page.
root_only=true returns one row per run, without the subagent sessions under it. List rows are summaries: they leave out snapshots, config is empty, and token totals aren’t included. Each row carries the session tree’s costUsd and costState (see Usage and cost).
List parameters and paging
List parameters and paging
A page token is valid for one hour and only with the same filters and
limit. Changing either returns 400 invalid_request; start again without a token. Because the list is ordered by last update, a session that changes while you page can appear twice or be skipped. Deduplicate by session_id, or filter on a value that does not change.How a session runs
Two fields describe a session.status says whether it’s still live. While it’s active, execution_state says what the agent loop is doing. When the loop isn’t running, stop_reason says why.
Statuses and execution states
Statuses and execution states
provisioning, queued, running, and idle are execution states of a session whose status is active. completed, failed, and cancelled are terminal statuses: the session does not change on its own after reaching one. A follow-up message to a root session in a terminal status starts it again from provisioning, or from queued when the agent is at its cap. After a cancel, the session gets a new sandbox. After a completed or failed run, the sandbox is reused when possible.When a root session is stopped for review and no subagent is working, its sandbox is stopped with /workspace preserved, and restored from /workspace before the agent’s next tool call; processes it started are gone. A session whose setup ran on its own compute keeps its sandbox until the environment’s idle stop.Every state transition
Every state transition
What can go wrong
The most common problems:- The session stays
queued. The agent is atmax_concurrent_sessions, or a slot freed while your tenant was out of credit. A queued session starts only when a slot is free and credit is available. Wait, cancel other sessions, raise the agent limit, or add credits. 422 environment_not_verifiedon start. The environment’s setup script has not passed a current setup run. Run environment setup, then start again. See Environments.status: completedbut the task is not done. The loop finishing does not mean the task succeeded. Read the final message, then send a follow-up with what is missing.
Every session error
Every session error
Every error is a flat object with required
code and message fields and optional details, which can include field, requestId, and retryable. See Errors.Next steps
Events
Stream, send, and read every kind of session event.
Session operations
Search metadata, inspect compute, ask the analyst, and read the tree.
Files
Give a session input files and download its outputs.
Deliverables and artifacts
Ask for deliverables and see how they’re kept.