Run and verify the environment's setup script
Requires Idempotency-Key because this operation provisions billable compute. Provisions fresh compute for the environment, runs its setup script exactly as a session would (same image, resources, variables, and secrets; no session credentials), records every line of output, profiles the compute, releases it, and writes the verdict to the environment’s setup_verification. Returns 202 with the queued run; poll getEnvironmentSetupRun with wait_seconds until status is succeeded, failed, or cancelled. On failure read hint, failed_line, and stderr_tail first, then the log. One run at a time per environment: a second request while one is in flight is a 409 naming the run to poll. Repeating the exact request with the same Idempotency-Key replays the original 202 response without starting another run. 400 when the environment has no setup script. This spends compute.
Authorizations
A Recursion API key, created in the console under API keys.
Headers
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.
1 - 256^[!-~]+$Path Parameters
Environment id (UUID) as returned by createEnvironment or listEnvironments.
Response
One execution of an environment's setup script on fresh compute: provision, GPU check, script, profile, image capture, cleanup. Read status until terminal, then hint, failed_line, and stderr_tail; the full log is a separate call.
One execution of an environment's setup script on fresh compute: provision, GPU check, script, profile, image capture, cleanup. Read status until terminal, then hint, failed_line, and stderr_tail; the full log is a separate call.
When the run was requested.
Environment whose setup ran.
manual (requested through the API to verify the environment) or session (performed while provisioning a session).
Organization that owns the environment.
Server-assigned id of the run.
queued, provisioning, running, succeeded, failed, or cancelled. Poll until one of the last three; getEnvironmentSetupRun accepts wait_seconds to do that server-side.
Provider id of the compute the run used. Released when the run ends.
What the compute turned out to be: vCPUs, memory, GPUs, Docker state, image tools. Recorded after setup passed.
Wall-clock duration in milliseconds, provisioning included.
Exit code of the setup script when it ran. 124 means the timeout elapsed.
The failing line's command as written, unexpanded.
1-based line in the setup script whose command exited non-zero. 0 when unknown.
Machine-readable failure class when the run did not succeed: environment_setup_failed, sandbox_capacity_unavailable, sandbox_gpu_not_ready, sandbox_provision_timeout, and so on. Same vocabulary as session failures.
Hash of the environment configuration the run executed.
When the run reached a terminal status.
GPU readiness report for accelerator environments.
Likely fix when the failure cause is recognised.
Stable identifier of the recognised failure cause.
Runner image the compute booted.
Capture failure recorded without changing the setup script verdict.
Agent Service image id being captured.
Bytes of log persisted for the run.
Lines of log persisted for the run. The last line's seq equals this; pass it as after to tail.
True when the script produced more output than the run keeps (4 MiB); the head and the stderr tail are retained.
One-sentence description of the outcome.
The call that acts on this result: re-run setup after fixing the script, or fetch the log.
Current or final phase: provision, gpu_check, setup, profile, commit, cleanup.
Last Agent Service setup event sequence persisted into this run's log.
Durable Agent Service run id executing the setup script.
User who requested a manual run.
Session the run provisioned, for kind session.
Immutable image published by this run when capture succeeded.
When provisioning began.
Last lines of stderr, redacted and bounded to 2 KiB.