Start a process
curl --request POST \
--url https://{identifier}.sandbox.tensorlake.ai/api/v1/processes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"command": "<string>",
"args": [
"<string>"
],
"env": {},
"working_dir": "<string>",
"user": "<string>"
}
'import requests
url = "https://{identifier}.sandbox.tensorlake.ai/api/v1/processes"
payload = {
"command": "<string>",
"args": ["<string>"],
"env": {},
"working_dir": "<string>",
"user": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
command: '<string>',
args: ['<string>'],
env: {},
working_dir: '<string>',
user: '<string>'
})
};
fetch('https://{identifier}.sandbox.tensorlake.ai/api/v1/processes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{identifier}.sandbox.tensorlake.ai/api/v1/processes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'command' => '<string>',
'args' => [
'<string>'
],
'env' => [
],
'working_dir' => '<string>',
'user' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{identifier}.sandbox.tensorlake.ai/api/v1/processes"
payload := strings.NewReader("{\n \"command\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"env\": {},\n \"working_dir\": \"<string>\",\n \"user\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{identifier}.sandbox.tensorlake.ai/api/v1/processes")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"command\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"env\": {},\n \"working_dir\": \"<string>\",\n \"user\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{identifier}.sandbox.tensorlake.ai/api/v1/processes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"command\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"env\": {},\n \"working_dir\": \"<string>\",\n \"user\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"handle": 123,
"pid": 123,
"status": "running",
"stdin_writable": true,
"command": "<string>",
"args": [
"<string>"
],
"started_at": 123,
"exit_code": 123,
"signal": 123,
"ended_at": 123
}{
"error": "<string>",
"code": "<string>"
}Process Management
Start Process
Start a new process through the sandbox proxy, for example on https://<sandbox-id-or-name>.sandbox.tensorlake.ai.
POST
/
api
/
v1
/
processes
Start a process
curl --request POST \
--url https://{identifier}.sandbox.tensorlake.ai/api/v1/processes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"command": "<string>",
"args": [
"<string>"
],
"env": {},
"working_dir": "<string>",
"user": "<string>"
}
'import requests
url = "https://{identifier}.sandbox.tensorlake.ai/api/v1/processes"
payload = {
"command": "<string>",
"args": ["<string>"],
"env": {},
"working_dir": "<string>",
"user": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
command: '<string>',
args: ['<string>'],
env: {},
working_dir: '<string>',
user: '<string>'
})
};
fetch('https://{identifier}.sandbox.tensorlake.ai/api/v1/processes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{identifier}.sandbox.tensorlake.ai/api/v1/processes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'command' => '<string>',
'args' => [
'<string>'
],
'env' => [
],
'working_dir' => '<string>',
'user' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{identifier}.sandbox.tensorlake.ai/api/v1/processes"
payload := strings.NewReader("{\n \"command\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"env\": {},\n \"working_dir\": \"<string>\",\n \"user\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{identifier}.sandbox.tensorlake.ai/api/v1/processes")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"command\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"env\": {},\n \"working_dir\": \"<string>\",\n \"user\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{identifier}.sandbox.tensorlake.ai/api/v1/processes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"command\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"env\": {},\n \"working_dir\": \"<string>\",\n \"user\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"handle": 123,
"pid": 123,
"status": "running",
"stdin_writable": true,
"command": "<string>",
"args": [
"<string>"
],
"started_at": 123,
"exit_code": 123,
"signal": 123,
"ended_at": 123
}{
"error": "<string>",
"code": "<string>"
}Start a new process inside a sandbox.
Use this endpoint on the sandbox proxy host:
Endpoint
POST /api/v1/processes
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",
"user": "tl-user",
"stdin_mode": "pipe",
"stdout_mode": "capture",
"stderr_mode": "capture"
}'
Request Body
{
"command": "python",
"args": ["-m", "http.server", "8080"],
"env": {"PORT": "8080"},
"working_dir": "/workspace",
"user": "tl-user",
"stdin_mode": "pipe",
"stdout_mode": "capture",
"stderr_mode": "capture"
}
commandis required.argsdefaults to[].envdefaults to{}and is applied to the process environment.working_diris optional.useris optional and accepts a username, UID string,uid:gidstring, or an object such as{"uid": 1000, "gid": 1000}. The default istl-user.stdin_modeacceptsclosedorpipe. The default isclosed.stdout_modeandstderr_modeacceptcaptureordiscard. The default iscapture.
Response
Tensorlake returns201 Created with the started process metadata:
{
"handle": 1,
"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
}
handle is a daemon-local stable identifier. Route paths use the operating-system pid.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Show child attributes
Show child attributes
Username, UID string, or uid:gid string.
Available options:
closed, pipe Available options:
capture, discard Available options:
capture, discard Response
Process created successfully
Available options:
running, exited, signaled, oom_killed Was this page helpful?