Update Benchmark Task Env Resources
curl --request PATCH \
--url https://api.trajectory.ai/api/v1/benchmarks/{bench_id}/tasks/{task_id}/env_resources \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"cpus": 1,
"memory_mb": 1,
"gpus": 1,
"allowed_hosts": [
"<string>"
]
}
'import requests
url = "https://api.trajectory.ai/api/v1/benchmarks/{bench_id}/tasks/{task_id}/env_resources"
payload = {
"cpus": 1,
"memory_mb": 1,
"gpus": 1,
"allowed_hosts": ["<string>"]
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({cpus: 1, memory_mb: 1, gpus: 1, allowed_hosts: ['<string>']})
};
fetch('https://api.trajectory.ai/api/v1/benchmarks/{bench_id}/tasks/{task_id}/env_resources', 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://api.trajectory.ai/api/v1/benchmarks/{bench_id}/tasks/{task_id}/env_resources",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'cpus' => 1,
'memory_mb' => 1,
'gpus' => 1,
'allowed_hosts' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://api.trajectory.ai/api/v1/benchmarks/{bench_id}/tasks/{task_id}/env_resources"
payload := strings.NewReader("{\n \"cpus\": 1,\n \"memory_mb\": 1,\n \"gpus\": 1,\n \"allowed_hosts\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.patch("https://api.trajectory.ai/api/v1/benchmarks/{bench_id}/tasks/{task_id}/env_resources")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"cpus\": 1,\n \"memory_mb\": 1,\n \"gpus\": 1,\n \"allowed_hosts\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trajectory.ai/api/v1/benchmarks/{bench_id}/tasks/{task_id}/env_resources")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"cpus\": 1,\n \"memory_mb\": 1,\n \"gpus\": 1,\n \"allowed_hosts\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"cpus": 123,
"memory_mb": 123,
"gpus": 123,
"network_mode": "no-network",
"allowed_hosts": [
"<string>"
]
}{
"error": {
"type": "invalid_request_error",
"code": "resource_not_found",
"message": "<string>",
"doc_url": "<string>",
"context": {},
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"context": {},
"param": "<string>"
}
}Specs (benchmarks)
Update Benchmark Task Env Resources
Change the CPU, memory, GPU or network settings of one benchmark task’s sandbox without uploading the task again. Only the fields in the request change. Rollouts that start after the change use it; sandboxes already running keep the settings they started with.
PATCH
/
api
/
v1
/
benchmarks
/
{bench_id}
/
tasks
/
{task_id}
/
env_resources
Update Benchmark Task Env Resources
curl --request PATCH \
--url https://api.trajectory.ai/api/v1/benchmarks/{bench_id}/tasks/{task_id}/env_resources \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"cpus": 1,
"memory_mb": 1,
"gpus": 1,
"allowed_hosts": [
"<string>"
]
}
'import requests
url = "https://api.trajectory.ai/api/v1/benchmarks/{bench_id}/tasks/{task_id}/env_resources"
payload = {
"cpus": 1,
"memory_mb": 1,
"gpus": 1,
"allowed_hosts": ["<string>"]
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({cpus: 1, memory_mb: 1, gpus: 1, allowed_hosts: ['<string>']})
};
fetch('https://api.trajectory.ai/api/v1/benchmarks/{bench_id}/tasks/{task_id}/env_resources', 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://api.trajectory.ai/api/v1/benchmarks/{bench_id}/tasks/{task_id}/env_resources",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'cpus' => 1,
'memory_mb' => 1,
'gpus' => 1,
'allowed_hosts' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://api.trajectory.ai/api/v1/benchmarks/{bench_id}/tasks/{task_id}/env_resources"
payload := strings.NewReader("{\n \"cpus\": 1,\n \"memory_mb\": 1,\n \"gpus\": 1,\n \"allowed_hosts\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.patch("https://api.trajectory.ai/api/v1/benchmarks/{bench_id}/tasks/{task_id}/env_resources")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"cpus\": 1,\n \"memory_mb\": 1,\n \"gpus\": 1,\n \"allowed_hosts\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trajectory.ai/api/v1/benchmarks/{bench_id}/tasks/{task_id}/env_resources")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"cpus\": 1,\n \"memory_mb\": 1,\n \"gpus\": 1,\n \"allowed_hosts\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"cpus": 123,
"memory_mb": 123,
"gpus": 123,
"network_mode": "no-network",
"allowed_hosts": [
"<string>"
]
}{
"error": {
"type": "invalid_request_error",
"code": "resource_not_found",
"message": "<string>",
"doc_url": "<string>",
"context": {},
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"context": {},
"param": "<string>"
}
}Body
application/json
Fields left out keep their stored value.
Domain names the sandbox may reach, such as pypi.org or *.example.com for every subdomain; no scheme, port, path or IP address. Only valid with allowlist.
Maximum string length:
253Pattern:
^(\*\.)?([A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?\.)+[A-Za-z]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?$Response
Successful Response