Skip to content
Navigation

Start an agent run in a space

Starts an agent inside this space: the run and its input files live there, so anything the agent files stays after the run ends.

Same body, same wait semantics and same run object as POST /v1/agent-runs — read the run back at GET /v1/spaces/{spaceId}/agents/{runId}, and steer, approve or cancel it on the ordinary /v1/agent-runs/{id} routes.

Learn more: Spaces

POST
https://api.cloudraker.com/v1/spaces/{spaceId}/agents
Try it
Path parameters
Query parameters
Request body
Live API request

This request can change data or incur charges for the selected organization.

Authorization

  • bearerAuth
    HTTP
    required

Path parameters

  • spaceId
    string
    required

Query parameters

  • wait
    optional
    integer

    How many seconds to hold the request open. Releases early the moment the run finishes or blocks on a person. Maximum 120; 0 returns immediately.

    maximum: 120 · minimum: 0 · default: 60

Request body JSON required

  • agent
    string
    required

    The agent to run, by id.

    minLength: 1
  • files
    array of
    required

    The files the agent works on, up to 200.

    Any of the following:

    • object
      • url
        string
        required
        format: uri
      • name
        optional
        string
        minLength: 1
      • processing
        optional
        auto
        or
        ocr
        or
        simple
        or
        transcribe
        or
        transcribe_diarize
    • object
      • id
        string
        required
        minLength: 1
  • metadata
    optional
    map of
    unknown

    Arbitrary JSON you attach to the run and get back on every read of it.

    Use it to carry your own identifiers — an order number, a customer id — so a webhook or a polled run reconciles without a lookup table. Capped at 10 KB serialized.

  • webhook
    optional

    Where to deliver this run's events, given one of two ways.

    • { "url": "…" } — a one-off https endpoint for this run only.
    • { "id": "whe_…" } — a saved endpoint from POST /v1/webhooks. Runs hold the reference, so pausing or re-pointing that endpoint applies to this run too.

    Deliveries are at-least-once and signed — dedupe on eventId and verify against GET /v1/webhooks/jwks.json.

    Any of the following:

    • object
      • url
        string
        required
        format: uri
    • object
      • id
        string
        required
        minLength: 1

Returns

200

The finished run.

JSON
  • object
    string
    required
  • id
    string
    required
  • agent
    object
    required
    • id
      string
      required
    • name
      string
      required
    • version
      number
      required
  • input
    object
    required
    • files
      array of
      object
      required

      The immutable input file ids. Reuse these with agent.id to start a successor after a terminal run.

      • id
        string
        required
  • status
    queued
    or
    processing
    or
    waiting
    or
    paused
    or
    completed
    or
    failed
    +2 more
    required

    Where the agent run is in its life.

    Status Meaning
    queued Accepted; its files are still being prepared
    processing The agent is working
    waiting Blocked on a person — see waiting, approvals and tasks[]
    paused Stopped short of finishing and resumable; not a failure
    completed Finished; result and output are populated
    failed Finished without producing a result
    cancelled Stopped on request
    expired Reached its expiresAt without finishing

    completed, failed, cancelled and expired are terminal. A completed run that still had outstanding work also carries incomplete: true.

  • progress
    object
    required
    • tasks
      object
      required
      • total
        number
        required
      • completed
        number
        required
  • tasks
    array of
    object
    required
    • id
      string
      required
    • title
      string
      required
    • executor
      agent
      or
      human
      required

      Who performs the step: agent runs by itself, human waits for a person to complete it.

    • status
      pending
      or
      ready
      or
      in_progress
      or
      completed
      or
      skipped
      required

      Where this step stands. pending is blocked on its dependencies, ready is claimable, skipped satisfies anything waiting on it.

    • summary
      string | null
      required
    • completedAt
      string | null
      required
    • note
      optional
      string
  • statusUrl
    string
    required
  • createdAt
    string
    required
  • expiresAt
    string | null
    required

    The run’s deadline: about seven days after it starts, an unfinished run parks itself for good and its status becomes expired. null once the run is finished. Files and anything the run already filed are never taken back.

  • finishedAt
    string | null
    required
  • waiting
    optional
    object

    What is blocking the run. Present while status is waiting.

    • approvals
      number
      required
    • tasks
      number
      required
    • summary
      string
      required
  • paused
    optional
    object

    Why the run parked. Present while status is paused. A paused run keeps everything it produced and can be started again.

    • reason
      model_error
      or
      system_error
      required
  • approvals
    optional
    array of
    object

    Sign-offs the run is waiting on, oldest first.

    • id
      string
      required
    • kind
      before
      or
      output
      required
    • action
      string
      required
    • requestedAt
      string
      required
    • files
      array of
      object
      required
      • id
        string
        required
      • name
        string
        required
    • rationale
      optional
      string | null
    • params
      optional
      map of
      unknown

      The inputs proposed for the step, for a before approval.

  • incomplete
    optional
    boolean

    Present and true on a completed run that still had outstanding work — read tasks[] to see what.

  • result
    optional
    string

    The agent's closing summary.

  • output
    optional
    object

    Files attached to the run while its steps were completed, each with a signed download link valid for about an hour.

    • files
      array of
      object
      required
      • id
        string
        required
      • name
        string
        required
      • url
        optional
        string
  • error
    optional
    object

    Why the run failed. Present whenever status is failed.

    • code
      string
      required
    • message
      string
      required
  • metadata
    optional
    map of
    unknown

202

Accepted — queued, still working, or blocked on a person.

JSON
  • object
    string
    required
  • id
    string
    required
  • status
    queued
    or
    processing
    or
    waiting
    or
    paused
    or
    completed
    or
    failed
    +2 more
    required

    Where the agent run is in its life.

    Status Meaning
    queued Accepted; its files are still being prepared
    processing The agent is working
    waiting Blocked on a person — see waiting, approvals and tasks[]
    paused Stopped short of finishing and resumable; not a failure
    completed Finished; result and output are populated
    failed Finished without producing a result
    cancelled Stopped on request
    expired Reached its expiresAt without finishing

    completed, failed, cancelled and expired are terminal. A completed run that still had outstanding work also carries incomplete: true.

  • statusUrl
    string
    required

400

Validation Error
JSON
  • success
    false
    required
  • error
    array of
    unknown
    required
  • data
    unknown
    required

404

Unknown agent, space, archived or expired space.

422

The agent cannot start, or an input file is unusable.

429

Rate limited. The /v1 API allows at least 67 requests per minute per organization (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the Retry-After interval and retry — the error is retryable.
JSON
  • code
    rate_limited
    required
  • message
    string
    required
  • retryable
    true
    required
  • requestId
    string
    required
  • docUrl
    optional
    string

Type to search…

↑↓ navigate↵ selectEsc close