Skip to main content
POST
Run and verify the environment's setup script

Authorizations

Authorization
string
header
required

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

Headers

Idempotency-Key
string
required

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

environmentId
string<uuid>
required

Environment id (UUID) as returned by managedAgentsCreateEnvironment or managedAgentsListEnvironments.

Body

application/json
requestKind
enum<string>
required
write-only

Declare that this is a manually requested setup verification run.

Available options:
manual

Response

Created

createdAt
string<date-time>
required
read-only

When the run was requested.

environmentId
string
required
read-only

Environment whose setup ran.

kind
string
required
read-only

manual (requested through the API), runner_refresh (automatically captures an image for the current runner), or session (legacy in-session setup).

organizationId
string
required
read-only

Organization that owns the environment.

setupRunId
string
required
read-only

Server-assigned id of the run.

status
string
required
read-only

queued, provisioning, running, succeeded, failed, or cancelled. Poll until one of the last three; managedAgentsGetEnvironmentSetupRunV2 accepts waitSeconds to do that server-side.

computeId
string
read-only

Provider id of the compute the run used. Released when the run ends.

computeProfile
object
read-only

What the compute turned out to be: vCPUs, memory, GPUs, Docker state, image tools. Recorded after setup passed.

durationMs
integer<int64>
read-only

Wall-clock duration in milliseconds, provisioning included.

Required range: -9007199254740991 <= x <= 9007199254740991
exitCode
integer
read-only

Exit code of the setup script when it ran. 124 means the timeout elapsed.

Required range: -9007199254740991 <= x <= 9007199254740991
failedCommand
string
read-only

The failing line's command as written, unexpanded.

failedLine
integer<int64>
read-only

1-based line in the setup script whose command exited non-zero. 0 when unknown.

Required range: -9007199254740991 <= x <= 9007199254740991
failureCode
string
read-only

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.

fingerprint
string
read-only

Hash of the environment configuration the run executed.

finishedAt
string<date-time>
read-only

When the run reached a terminal status.

gpuReadiness
object
read-only

GPU readiness report for accelerator environments.

hint
string
read-only

Likely fix when the failure cause is recognised.

hintCode
string
read-only

Stable identifier of the recognised failure cause.

image
string
read-only

Runner image the compute booted.

imageCapture
object
read-only

Capture failure recorded without changing the setup script verdict.

imageId
string
read-only

Agent Service image id being captured.

logBytes
integer<int64>
read-only

Bytes of log persisted for the run.

Required range: -9007199254740991 <= x <= 9007199254740991
logLines
integer<int64>
read-only

Lines of log persisted for the run. The last line's seq equals this; pass it as after to tail.

Required range: -9007199254740991 <= x <= 9007199254740991
logTruncated
boolean
read-only

True when the script produced more output than the run keeps (4 MiB); the head and the stderr tail are retained.

message
string
read-only

One-sentence description of the outcome.

nextAction
object
read-only

The call that acts on this result: re-run setup after fixing the script, or fetch the log.

phase
string
read-only

Current or final phase: provision, gpu_check, setup, profile, commit, cleanup.

providerRunId
string
read-only

Durable Agent Service run id executing the setup script.

requestedByUserId
string
read-only

User who requested a manual run.

sessionId
string
read-only

Session the run provisioned, for kind session.

setupImage
object
read-only

Immutable image published by this run when capture succeeded.

startedAt
string<date-time>
read-only

When provisioning began.

stderrTail
string
read-only

Last lines of stderr, redacted and bounded to 2 KiB.