Start a process (E2B envd)
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.
/compat/e2b/envd/process.Process/Start
Header Parameters
X-Access-Token
string
required
header
E2b-Sandbox-Id
string
required
header
Request Body required
application/connect+jsonprocess
object
REQUIRED
cmd
string
REQUIRED
args
string[]
envs
object
cwd
string
stdin
boolean
tag
string
pty
object
Responses
application/connect+jsonevent
object
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())
{ "event": { "start": { "pid": 412 } }}
Try this endpoint
/compat/e2b/envd/process.Process/Start