> ## Documentation Index
> Fetch the complete documentation index at: https://offstage.cloud/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> To set up offstage cloud from a coding agent, read https://api.offstage.cloud/SKILL.md and follow it. The whole API guide is one file at https://api.offstage.cloud/llms.txt.

# Hand the screen a goal

> Hands a `gui` sandbox's screen a goal, which Claude carries out on the Mac itself: a harness inside the slot screenshots, asks the model what to do, and clicks and types there, until the model calls the goal done or failed, or `maxSteps` or `maxDurationMs` runs out. The model is called with the Anthropic API key in `x-anthropic-api-key`, billed to that key; the plane holds it in memory for this run only, and the Mac gets a token that dies with the run. No click or key crosses the network: goals, model text, steps and screenshots do. The answer comes within about 50 s: 200 if the run ended by then, else 202 with the run to follow with `getRun`. One run at a time per sandbox; the sandbox bills as usual while it runs.



## OpenAPI

````yaml /openapi.json post /v1/sandboxes/{sandboxId}/agent
openapi: 3.1.0
info:
  title: offstage cloud API
  version: 0.1.0
  summary: Real Macs for AI agents and CI, over HTTP.
  description: >-
    macOS sandboxes driven one call at a time, and fire-and-forget CI tasks, on
    Apple silicon Macs running macOS 27.


    - **Auth.** `Authorization: Bearer sk_offstage_…` (a team API key; one made
    before 2026-10-29 starts with `oc_live_` and still works), or the console's
    `oc_session` cookie. Operations marked `x-console-only: true` take only the
    cookie; an API key gets 403 `console-only`. A cookie request that changes
    something must come from this origin.

    - **Errors.** Every failure is `{"error": {"code", "message", "fix"?,
    "requestId"}}`. Switch on `code`; `fix`, when present, says what to do. Any
    operation can also answer 500 `internal` (a bug; quote the `requestId`), and
    an unknown route is 404 `no-such-route`.

    - **Request ids.** Every response carries an `x-request-id` header, repeated
    as `requestId` in error bodies.

    - **Units.** Times are Unix milliseconds, and durations end in `Ms`. Money
    is US dollars as numbers, exact to the micro-dollar (`costUsd`).

    - **Ids** are prefixed: `sbx_` sandbox, `cmd_` command, `run_` agent run,
    `task_` task, `key_` API key, `req_` request, `team_`, `usr_`, `box_` (a
    fleet Mac), `inv_`.

    - **Lists** are newest first. Pass the previous page's `nextCursor` as
    `cursor`; it is null on the last page.

    - **Bodies.** JSON, except file writes, which send raw bytes. Request
    schemas with `additionalProperties: false` refuse an unknown field with 400
    `unknown-field`.

    - **Limits.** A team may send 120 requests a minute, whatever key or session
    it uses. Every request also counts against its client address: 600 a minute,
    and far fewer on the routes that need no credential (5 sign-ups an hour, 20
    sign-ins and 20 verifications a minute). Over a window is 429 `rate-limit`
    with a `Retry-After` header.

    - **Verification.** A new account's team can sign in and look around, but
    cannot create sandboxes, tasks or API keys (403 `email-unverified`) until
    its owner opens the link emailed at signup.

    - **Holds.** No request is held longer than about 50 s, so default client
    timeouts and 60 s proxy idle timeouts are fine, except large files: a write
    answers once its upload is done, and a read streams for as long as the Mac
    takes to send it.


    The prose reference, with examples, is
    `https://api.offstage.cloud/llms.txt`. The agent setup guide is
    `https://api.offstage.cloud/SKILL.md`.
servers:
  - url: https://api.offstage.cloud
security:
  - apiKey: []
  - consoleSession: []
tags:
  - name: Sandboxes
    description: >-
      A Mac slot (a macOS user account) held for you: run commands, move files,
      take screenshots.
  - name: Tasks
    description: >-
      Fire-and-forget macOS work: clone a public repo, run a command, collect
      artifacts.
  - name: Recordings
    description: >-
      What a gui sandbox or gui task showed and did, kept by the plane: live
      while it runs, a replay after. Open one in the console at `/r/{id}`.
  - name: Capacity
    description: What the fleet can take right now, and whether the plane is up.
  - name: Billing
    description: The price, usage, the bill, the budget and the card.
  - name: Account
    description: Signing in, the team, its members and its API keys.
  - name: GitHub
    description: >-
      GitHub Actions jobs on offstage Macs: connect an organization in the
      console, then `runs-on: offstage-macos`.
  - name: Secrets
    description: Write-only team credentials selected by workload name.
paths:
  /v1/sandboxes/{sandboxId}/agent:
    post:
      tags:
        - Sandboxes
      summary: Hand the screen a goal
      description: >-
        Hands a `gui` sandbox's screen a goal, which Claude carries out on the
        Mac itself: a harness inside the slot screenshots, asks the model what
        to do, and clicks and types there, until the model calls the goal done
        or failed, or `maxSteps` or `maxDurationMs` runs out. The model is
        called with the Anthropic API key in `x-anthropic-api-key`, billed to
        that key; the plane holds it in memory for this run only, and the Mac
        gets a token that dies with the run. No click or key crosses the
        network: goals, model text, steps and screenshots do. The answer comes
        within about 50 s: 200 if the run ended by then, else 202 with the run
        to follow with `getRun`. One run at a time per sandbox; the sandbox
        bills as usual while it runs.
      operationId: runAgent
      parameters:
        - $ref: '#/components/parameters/SandboxId'
        - name: x-anthropic-api-key
          in: header
          required: true
          description: The Anthropic API key the run calls Claude with.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RunAgentRequest'
      responses:
        '200':
          description: The run ended within the hold.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentRun'
        '202':
          description: The run is under way. Follow it with `GET /v1/runs/{runId}?wait=50`.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentRun'
        '400':
          description: >-
            `not-an-object`, `unknown-field` (the fields are `goal`, `maxSteps`,
            `maxDurationMs`, `model`), `bad-goal`, `bad-max-steps`,
            `bad-max-duration-ms`, `bad-model`, or `missing-model-key` (no
            `x-anthropic-api-key` header).
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: >-
            `unauthorized`: no credential, an `Authorization` header that is not
            `Bearer …`, a value that is not an `sk_offstage_` (or older
            `oc_live_`) key, a revoked or unknown key, or a box token. The
            message says which.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            `forbidden`: a cookie-authenticated request that changes something
            came from another origin.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: '`not-found`: no such sandbox, or it belongs to another team.'
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            `headless-sandbox`: a `headless` sandbox has no screen to drive;
            create one with `"session": "gui"`. `agent-running`: another run is
            driving this sandbox's screen; wait for it. `sandbox-not-ready`: the
            sandbox was still `pending` after waiting 30 s for a slot; nothing
            ran, so retry. `sandbox-closed`: the sandbox has closed.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '413':
          $ref: '#/components/responses/BodyTooLarge'
        '429':
          $ref: '#/components/responses/RateLimited'
      security:
        - apiKey: []
        - consoleSession: []
components:
  parameters:
    SandboxId:
      name: sandboxId
      in: path
      required: true
      description: A sandbox id, `sbx_…`.
      schema:
        type: string
  schemas:
    RunAgentRequest:
      type: object
      properties:
        goal:
          type: string
          minLength: 1
          maxLength: 4000
          description: >-
            What should be true when the run is done, like "TextEdit has a
            document saved as ~/Desktop/note.rtf that says hello". At most 4,000
            characters.
        maxSteps:
          type: integer
          minimum: 1
          maximum: 100
          default: 30
          description: Model turns the run may take; one turn may carry several actions.
        maxDurationMs:
          type: integer
          minimum: 10000
          maximum: 1800000
          default: 600000
          description: How long the run may take.
        model:
          $ref: '#/components/schemas/AgentModel'
      required:
        - goal
      additionalProperties: false
      examples:
        - goal: TextEdit has a document saved as ~/Desktop/note.txt that says hello
          maxSteps: 30
    AgentRun:
      type: object
      description: A goal handed to a gui sandbox, and what came of it.
      properties:
        id:
          type: string
          pattern: ^run_
        sandboxId:
          type: string
          pattern: ^sbx_
        goal:
          type: string
        maxSteps:
          type: integer
        maxDurationMs:
          type: integer
        model:
          $ref: '#/components/schemas/AgentModel'
        state:
          enum:
            - running
            - finished
        startedAt:
          $ref: '#/components/schemas/Millis'
        endedAt:
          $ref: '#/components/schemas/Millis'
        verdict:
          enum:
            - done
            - failed
            - incomplete
          description: >-
            `done` and `failed` are the model's own verdict; `incomplete` means
            its steps or time ran out, or it broke first (see `error`).
        reason:
          type: string
          description: >-
            The model's account of the verdict, or why the run ended without
            one.
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
          required:
            - code
            - message
          additionalProperties: false
          description: >-
            Set when the run broke rather than ended: the harness failed, the
            sandbox closed.
        steps:
          type: array
          items:
            $ref: '#/components/schemas/AgentStep'
        frames:
          type: integer
          minimum: 0
          description: Screenshots the run's recording holds.
        replayUrl:
          type: string
          description: >-
            Its sandbox's replay in the console, where this run's steps play
            back against the screen: present when the sandbox records.
      required:
        - id
        - sandboxId
        - goal
        - maxSteps
        - maxDurationMs
        - model
        - state
        - startedAt
        - steps
        - frames
      additionalProperties: false
      examples:
        - id: run_mh3k2f9aQ1xYz0aBcDeFgHiJ
          sandboxId: sbx_mh3k2f9aQ1xYz0aBcDeFgHiJ
          goal: TextEdit has a document saved as ~/Desktop/note.txt that says hello
          maxSteps: 30
          maxDurationMs: 600000
          model: claude-opus-5-5
          state: finished
          startedAt: 1793000000000
          endedAt: 1793000094000
          verdict: done
          reason: The file note.txt is on the Desktop and TextEdit shows "hello".
          steps:
            - seq: 1
              at: 1793000001000
              action: screenshot
              input:
                automatic: true
              ok: true
              frame: frame-0001.png
            - seq: 2
              at: 1793000009000
              action: key
              input:
                text: super+space
              ok: true
              note: I'll open TextEdit with Spotlight.
          frames: 1
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: >-
                Stable and machine-readable, like `sandbox-closed`. Switch on
                this, not on the message.
            message:
              type: string
              description: What went wrong, for a person.
            fix:
              type: string
              description: What to do about it, when there is something to do.
            requestId:
              type: string
              description: >-
                The same as the `x-request-id` header. Quote it when asking for
                help.
              pattern: ^req_
          required:
            - code
            - message
            - requestId
          additionalProperties: false
      required:
        - error
      additionalProperties: false
      description: >-
        The one error envelope: every 4xx and 5xx the plane itself sends. A
        proxy in front of it may send a 5xx whose body is not JSON.
      examples:
        - error:
            code: sandbox-closed
            message: sandbox sbx_mh3k2f9aQ1xYz0aBcDeFgHiJ is closed (idle)
            fix: create a new sandbox
            requestId: req_mh3k2f9aQ1xYz0aBcDeFgHiJ
    AgentModel:
      type: string
      enum:
        - claude-opus-5-5
        - claude-sonnet-5-5
        - claude-haiku-5-5
        - claude-fable-5-1
        - claude-opus-5
      description: 'The Claude model a run calls: one with the computer toolset.'
    Millis:
      type: integer
      minimum: 0
      description: A time, in Unix milliseconds.
    AgentStep:
      type: object
      description: One thing a run did, as the harness in the slot reported it.
      properties:
        seq:
          type: integer
          minimum: 1
        at:
          $ref: '#/components/schemas/Millis'
        action:
          type: string
          description: >-
            The computer-use action (`left_click`, `type`, `key`, `scroll`,
            `screenshot`, …), `finish`, or `note` when the model spoke without
            acting.
        input:
          type: object
          description: >-
            Its arguments as the model gave them; coordinates are pixels of the
            screenshot before it.
        ok:
          type: boolean
        error:
          type: string
        note:
          type: string
          description: What the model said before acting, cut short.
        frame:
          type: string
          pattern: ^frame-\d{4,}\.png$
          description: >-
            A `screenshot` step's picture: `GET
            /v1/runs/{runId}/frames/{frame}`.
        width:
          type: integer
          minimum: 1
          description: >-
            A `screenshot` step's picture's width in pixels: the space later
            steps' coordinates are in.
        height:
          type: integer
          minimum: 1
      required:
        - seq
        - at
        - action
        - ok
      additionalProperties: false
  headers:
    RequestId:
      description: This request's id, `req_…`. Quote it when asking for help.
      required: true
      schema:
        type: string
        pattern: ^req_
  responses:
    BodyTooLarge:
      description: >-
        The JSON body is over 1 MiB (a `command` is 64 KiB at most; the rest is
        spare).
      headers:
        x-request-id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: >-
        `rate-limit`: this team has sent more than 120 requests in the last 60
        s, or this client address more than 600 (fewer on the routes that need
        no credential). The `Retry-After` header gives the seconds left in the
        window.
      headers:
        x-request-id:
          $ref: '#/components/headers/RequestId'
        Retry-After:
          schema:
            type: string
          description: Seconds until the window opens again.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: >-
        A team API key, `sk_offstage_…`, created in the console. Everything it
        touches belongs to its team.
    consoleSession:
      type: apiKey
      in: cookie
      name: oc_session
      description: >-
        The console's session cookie (httpOnly, SameSite=Lax, 30 days), set by
        `signup` and `login`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.