POST /compat/e2b/envd/process.Process/Start
envd's `process.Process/Start` (what the SDKs' `commands.run` and `commands.start` call): runs `process.cmd` with `process.args`, `process.envs` and `process.cwd` as the sandbox's `user` (or `root` when the SDK's `user` option asks, sent as `Authorization: Basic`), and streams Connect envelopes: a `start` event with the pid, `data` events (`stdout`, `stderr` as base64), keepalives, then an `end` event with the exit code. The process belongs to the sandbox, not to the stream: closing the stream leaves it running (the SDKs' `background: true`), and `Connect` streams it again. `Connect-Timeout-Ms` bounds the process (at most 1 hour; 0 or absent is the hour). `stdin: true` and `pty` are refused with `invalid_argument`. Runs as the key that minted the envd access token, with `sandboxes:run` on this sandbox only.

Header Parameters

X-Access-Token string required header
The sandbox's envd access token (`b3os_et_…`), from the create or connect answer.
E2b-Sandbox-Id string required header
The sandbox the call is for (`sandboxID` of the create answer). The token must be this sandbox's.

Request Body required

application/connect+json
process object REQUIRED
cmd string REQUIRED
args string[]
Array of: string
envs object
cwd string
stdin boolean
`true` is refused.
tag string
pty object
Refused.

Responses

200 The process's events, as Connect envelopes (5-byte header, then JSON), ending with the end-of-stream envelope.
application/connect+json
event object
401 The envd call is refused (`envd_token_invalid`), the same answer on every envd path whatever the reason, in E2B's error shape (Connect clients read the 401 as `unauthenticated`).
curl -X POST 'https://beta-api.b3os.org/compat/e2b/envd/process.Process/Start' \  -H 'Authorization: Bearer YOUR_API_TOKEN' \  -H 'X-Access-Token: string' \  -H 'E2b-Sandbox-Id: string' \  -H 'Content-Type: application/json' \  -d '{  "process": {    "cmd": "/bin/bash",    "args": [      "-l",      "-c",      "echo hello"    ]  },  "stdin": false}'
const response = await fetch('https://beta-api.b3os.org/compat/e2b/envd/process.Process/Start', {  method: 'POST',  headers: {      "Authorization": "Bearer YOUR_API_TOKEN",      "Content-Type": "application/json",      "X-Access-Token": "string",      "E2b-Sandbox-Id": "string"  },  body: JSON.stringify({    "process": {      "cmd": "/bin/bash",      "args": [        "-l",        "-c",        "echo hello"      ]    },    "stdin": false  })});const data = await response.json();console.log(data);
import requestsheaders = {    'Authorization': 'Bearer YOUR_API_TOKEN',    'X-Access-Token': 'string',    'E2b-Sandbox-Id': 'string'}response = requests.post('https://beta-api.b3os.org/compat/e2b/envd/process.Process/Start', headers=headers, json={  "process": {    "cmd": "/bin/bash",    "args": [      "-l",      "-c",      "echo hello"    ]  },  "stdin": false})print(response.json())
200 Response
{  "event": {    "start": {      "pid": 412    }  }}
Ask a question... ⌘I