> For the complete documentation index, see [llms.txt](https://docs.release.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.release.com/reference-documentation/release-api/ai-sandbox-api/executions.md).

# Executions

The Executions API lets you run commands and tools inside a sandbox session. Each execution captures the command or tool invocation along with its output, exit code, and timing information.

***

## List Executions

Retrieve all executions for a given sandbox session.

#### Endpoint

<mark style="color:green;">`GET`</mark> `https://backend-{handle}-envs.gcp.release.com/ai/accounts/{accountId}/sandbox_sessions/{id}/executions`

#### Authentication

Authenticate using headers from your `~/.release.yaml` file. To set this up, [install the Release CLI](/cli/installation.md) and run `release auth login`.

| Header       | Description                                       |
| ------------ | ------------------------------------------------- |
| X-User-Email | User email from `~/.release.yaml` (`login` field) |
| X-User-Token | User token from `~/.release.yaml` (`token` field) |

#### Headers

| Header | Value              |
| ------ | ------------------ |
| Accept | `application/json` |

#### Path Parameters

| Name      | Type            | Required | Description            |
| --------- | --------------- | -------- | ---------------------- |
| accountId | string (hashid) | Yes      | The Release account ID |
| id        | string (hashid) | Yes      | The sandbox session ID |

#### Status Codes

| Code | Description                                   |
| ---- | --------------------------------------------- |
| 200  | Returns array of executions                   |
| 401  | Unauthorized — invalid or missing credentials |
| 404  | Session not found                             |

#### Response Body

Returns an array of execution objects. See [execution fields](#execution-response-fields) below.

#### Example Responses

**200 OK**

```json
{
  "data": [
    {
      "id": "eX7kP2",
      "command": "ls -la /mnt/session/repos",
      "tool_name": null,
      "tool_input": null,
      "stdout": "total 4\ndrwxr-xr-x 3 root root 4096 Jun 01 10:00 api-server\n",
      "stderr": "",
      "exit_code": 0,
      "started_at": "2026-06-01T10:10:00Z",
      "completed_at": "2026-06-01T10:10:01Z",
      "created_at": "2026-06-01T10:10:00Z"
    }
  ]
}
```

***

## Create Execution

Run a shell command or invoke a tool inside a sandbox session. At least one of `command` or `tool_name` should be provided.

#### Endpoint

<mark style="color:green;">`POST`</mark> `https://backend-{handle}-envs.gcp.release.com/ai/accounts/{accountId}/sandbox_sessions/{id}/executions`

#### Authentication

Authenticate using headers from your `~/.release.yaml` file. To set this up, [install the Release CLI](/cli/installation.md) and run `release auth login`.

| Header       | Description                                       |
| ------------ | ------------------------------------------------- |
| X-User-Email | User email from `~/.release.yaml` (`login` field) |
| X-User-Token | User token from `~/.release.yaml` (`token` field) |

#### Headers

| Header       | Value              |
| ------------ | ------------------ |
| Content-Type | `application/json` |
| Accept       | `application/json` |

#### Path Parameters

| Name      | Type            | Required | Description            |
| --------- | --------------- | -------- | ---------------------- |
| accountId | string (hashid) | Yes      | The Release account ID |
| id        | string (hashid) | Yes      | The sandbox session ID |

#### Request Body

| Field       | Type   | Required | Description                   |
| ----------- | ------ | -------- | ----------------------------- |
| command     | string | No       | Shell command to execute      |
| tool\_name  | string | No       | Name of the tool to run       |
| tool\_input | object | No       | Input parameters for the tool |

**Example — Shell command**

```json
{
  "command": "ls -la /mnt/session/repos"
}
```

**Example — Tool invocation**

```json
{
  "tool_name": "file_search",
  "tool_input": {
    "query": "database connection",
    "path": "/mnt/session/repos/api-server"
  }
}
```

#### Status Codes

| Code | Description                                   |
| ---- | --------------------------------------------- |
| 201  | Execution created                             |
| 401  | Unauthorized — invalid or missing credentials |
| 404  | Session not found                             |
| 422  | Validation error                              |

#### Response Body

See [execution fields](#execution-response-fields) below.

#### Example Responses

**201 Created**

```json
{
  "data": {
    "id": "eX7kP2",
    "command": "ls -la /mnt/session/repos",
    "tool_name": null,
    "tool_input": null,
    "stdout": "total 4\ndrwxr-xr-x 3 root root 4096 Jun 01 10:00 api-server\n",
    "stderr": "",
    "exit_code": 0,
    "started_at": "2026-06-01T10:10:00Z",
    "completed_at": "2026-06-01T10:10:01Z",
    "created_at": "2026-06-01T10:10:00Z"
  }
}
```

**422 Unprocessable Entity**

```json
{
  "errors": [
    {
      "code": "validation_error",
      "message": "Either command or tool_name must be provided"
    }
  ]
}
```

***

## Get Execution

Retrieve a specific execution by ID.

#### Endpoint

<mark style="color:green;">`GET`</mark> `https://backend-{handle}-envs.gcp.release.com/ai/accounts/{accountId}/sandbox_sessions/{id}/executions/{execId}`

#### Authentication

Authenticate using headers from your `~/.release.yaml` file. To set this up, [install the Release CLI](/cli/installation.md) and run `release auth login`.

| Header       | Description                                       |
| ------------ | ------------------------------------------------- |
| X-User-Email | User email from `~/.release.yaml` (`login` field) |
| X-User-Token | User token from `~/.release.yaml` (`token` field) |

#### Headers

| Header | Value              |
| ------ | ------------------ |
| Accept | `application/json` |

#### Path Parameters

| Name      | Type            | Required | Description            |
| --------- | --------------- | -------- | ---------------------- |
| accountId | string (hashid) | Yes      | The Release account ID |
| id        | string (hashid) | Yes      | The sandbox session ID |
| execId    | string (hashid) | Yes      | The execution ID       |

#### Status Codes

| Code | Description                                   |
| ---- | --------------------------------------------- |
| 200  | Returns the execution                         |
| 401  | Unauthorized — invalid or missing credentials |
| 404  | Session or execution not found                |

#### Response Body

| Field         | Type                      | Description                               |
| ------------- | ------------------------- | ----------------------------------------- |
| id            | string (hashid)           | Unique identifier for the execution       |
| command       | string or null            | Shell command that was executed           |
| tool\_name    | string or null            | Name of the tool that was invoked         |
| tool\_input   | object or null            | Input parameters passed to the tool       |
| stdout        | string or null            | Standard output from the execution        |
| stderr        | string or null            | Standard error from the execution         |
| exit\_code    | integer or null           | Process exit code (`0` indicates success) |
| started\_at   | string (ISO 8601)         | When the execution started                |
| completed\_at | string (ISO 8601) or null | When the execution finished               |
| created\_at   | string (ISO 8601)         | When the execution record was created     |

#### Example Responses

**200 OK**

```json
{
  "data": {
    "id": "eX7kP2",
    "command": "ls -la /mnt/session/repos",
    "tool_name": null,
    "tool_input": null,
    "stdout": "total 4\ndrwxr-xr-x 3 root root 4096 Jun 01 10:00 api-server\n",
    "stderr": "",
    "exit_code": 0,
    "started_at": "2026-06-01T10:10:00Z",
    "completed_at": "2026-06-01T10:10:01Z",
    "created_at": "2026-06-01T10:10:00Z"
  }
}
```

**404 Not Found**

```json
{
  "errors": [
    {
      "code": "not_found",
      "message": "Execution not found"
    }
  ]
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.release.com/reference-documentation/release-api/ai-sandbox-api/executions.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
