---
title: "Start a streamed sandbox command"
method: POST
path: "/api/v2/sandboxes/{sandbox_id}/execute/stream/start"
tags: ["sandboxes"]
---

# Start a streamed sandbox command

`POST /api/v2/sandboxes/{sandbox_id}/execute/stream/start`

## Request

- Base URL: `https://api.smith.langchain.com`
- URL: `https://api.smith.langchain.com/api/v2/sandboxes/{sandbox_id}/execute/stream/start`
- Auth: one of:
  - API key in header `X-API-Key`
  - API key in header `X-Tenant-Id`
  - HTTP bearer

Execute a command inside a sandbox and stream stdout/stderr as Server-Sent Events with base64 payloads. Requires a sandbox on the v2 runtime. Passing a command_id reuses a running command instead of starting a second one. The response ends with an ack_required event when the sandbox's output buffer needs an ack; continue from the reported offsets with the resume endpoint.

## Path parameters

- `sandbox_id` string, required

## Request body

- SandboxesExecStreamRequest
  - `command` string[]: Command accepts either a shell command string or an argv string array.
  - `command_id` string: CommandID makes the request idempotent: a known ID attaches to that running command instead of starting a second one.
  - `cwd` string: Deprecated: use run_config.work_dir. Rejected when run_config is also set.
  - `env` object: Deprecated: use run_config.env_vars. Rejected when run_config is also set.
  - `idle_timeout_seconds` integer: 0 = default, -1 = never idle-kill
  - `run_config` SandboxapiRunConfig
    - `env_vars` object
    - `user` string
    - `work_dir` string
  - `shell` string
  - `stdin` string, byte: Stdin is the process's entire standard input, base64 on the wire. It is written once when the command is spawned and then closed, so the process reads EOF; there is no stdin streaming on this endpoint.
  - `timeout_seconds` integer: 0 = no timeout
  - `ttl_seconds` integer: 0 = default, -1 = keep forever

## Response `200`

SSE event stream

## Other responses

- `400`: Bad Request
- `403`: Forbidden
- `404`: Not Found
- `409`: Conflict
- `500`: Internal Server Error

## Changes

- **2026-10-16** `1a8ee9358d81`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/langchain-ai/apis/langsmith/changes/api/v2/sandboxes/:sandbox_id/execute/stream/start/post.md)

---

[API](https://skmtc.dev/langchain-ai/apis/langsmith.md) - [All operations](https://skmtc.dev/langchain-ai/apis/langsmith/llms.txt) - [OpenAPI document](https://skmtc.dev/langchain-ai/apis/langsmith/revisions/7a01c01f75e8?raw)
