Skip to main content
POST
/
api
/
v1
/
processes
Start a process
curl --request POST \
  --url https://{sandbox_id_or_name}.sandbox.tensorlake.ai/api/v1/processes \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "command": "<string>",
  "args": [
    "<string>"
  ],
  "env": {},
  "working_dir": "<string>",
  "stdin_mode": "closed",
  "stdout_mode": "capture",
  "stderr_mode": "capture"
}
'
{
  "pid": 123,
  "status": "running",
  "stdin_writable": true,
  "command": "<string>",
  "args": [
    "<string>"
  ],
  "started_at": 123,
  "exit_code": 123,
  "signal": 123,
  "ended_at": 123
}
Start a new process inside a sandbox.

Endpoint

POST /api/v1/processes
Use this endpoint on the sandbox proxy host:
https://<sandbox-id-or-name>.sandbox.tensorlake.ai/api/v1/processes

Example Request

curl -X POST https://<sandbox-id>.sandbox.tensorlake.ai/api/v1/processes \
  -H "Authorization: Bearer $TENSORLAKE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "command": "python",
    "args": ["-m", "http.server", "8080"],
    "env": {"PORT": "8080"},
    "working_dir": "/workspace",
    "stdin_mode": "pipe",
    "stdout_mode": "capture",
    "stderr_mode": "capture"
  }'

Request Body

{
  "command": "python",
  "args": ["-m", "http.server", "8080"],
  "env": {"PORT": "8080"},
  "working_dir": "/workspace",
  "stdin_mode": "pipe",
  "stdout_mode": "capture",
  "stderr_mode": "capture"
}
  • command is required.
  • args defaults to [].
  • env defaults to {}.
  • working_dir is optional.
  • stdin_mode accepts closed or pipe. The default is closed.
  • stdout_mode and stderr_mode accept capture or discard. The default is capture.

Response

Tensorlake returns 201 Created with the started process metadata:
{
  "pid": 42,
  "status": "running",
  "exit_code": null,
  "signal": null,
  "stdin_writable": true,
  "command": "python",
  "args": ["-m", "http.server", "8080"],
  "started_at": 1710000000000,
  "ended_at": null
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
command
string
required
args
string[]
env
object
working_dir
string
stdin_mode
enum<string>
Available options:
closed,
pipe
stdout_mode
enum<string>
Available options:
capture,
discard
stderr_mode
enum<string>
Available options:
capture,
discard

Response

Process created successfully

pid
integer<int32>
required
status
enum<string>
required
Available options:
running,
exited,
signaled
stdin_writable
boolean
required
command
string
required
args
string[]
required
started_at
integer<int64>
required
exit_code
integer<int32> | null
signal
integer<int32> | null
ended_at
integer<int64> | null