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

# Execute in runtime sandbox

> Run a shell command in the workspace runtime sandbox. Tracked working-tree changes the command produced (additions, edits, deletions, renames) are auto-committed and pushed to the workspace's default branch as a single commit. Pass `commitMessage` to customize the commit subject; gitignored paths are skipped. The response's `commit` field is present iff a commit landed.



## OpenAPI

````yaml https://api.getcargo.io/openapi.json post /context/runtime/execute
openapi: 3.1.0
info:
  title: Cargo API
  version: 1.0.0
  description: Cargo Platform API v1
servers:
  - url: https://api.getcargo.io/v1
    description: Cargo API
security:
  - bearerAuth: []
paths:
  /context/runtime/execute:
    post:
      tags:
        - Context - Runtime
      summary: Execute in runtime sandbox
      description: >-
        Run a shell command in the workspace runtime sandbox. Tracked
        working-tree changes the command produced (additions, edits, deletions,
        renames) are auto-committed and pushed to the workspace's default branch
        as a single commit. Pass `commitMessage` to customize the commit
        subject; gitignored paths are skipped. The response's `commit` field is
        present iff a commit landed.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                command:
                  type: string
                  minLength: 1
                  title: Command
                  description: Shell command to run inside the runtime sandbox.
                args:
                  title: Arguments
                  description: Optional arguments passed to the command.
                  type: array
                  items:
                    type: string
                commitMessage:
                  title: Commit message
                  description: >-
                    Optional override for the auto-commit message. When the
                    command leaves uncommitted changes (additions, edits,
                    deletions, renames) in the working tree, those changes are
                    always pushed to the workspace repo's default branch as a
                    single commit; this field only customizes the commit
                    subject. Defaults to `context(runtime): execute <command>`.
                  type: string
                  minLength: 1
              required:
                - command
              additionalProperties: false
              title: Request body
              description: >-
                Run a shell command in the workspace runtime sandbox. Tracked
                working-tree changes are auto-committed and pushed to the
                workspace's default branch; gitignored paths are skipped.
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  exitCode:
                    type: number
                    title: Exit code
                  stdout:
                    type: string
                    title: Stdout
                  stderr:
                    type: string
                    title: Stderr
                  commit:
                    title: Commit
                    description: >-
                      Present iff the command left the working tree dirty AND
                      the resulting auto-push landed on the default branch.
                      Absent when the command produced no tracked changes or
                      when the push didn't land — the server logs capture the
                      reason in the latter case.
                    type: object
                    properties:
                      sha:
                        type: string
                        title: SHA
                      message:
                        type: string
                        title: Message
                    required:
                      - sha
                      - message
                    additionalProperties: false
                required:
                  - exitCode
                  - stdout
                  - stderr
                additionalProperties: false
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '404':
          description: Not found
        '500':
          description: Internal server error
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````