import Runloop from '@runloop/api-client';
const client = new Runloop({
bearerToken: process.env['RUNLOOP_API_KEY'], // This is the default and can be omitted
});
const scenarioRunView = await client.scenarios.startRun({ scenario_id: 'scenario_id' });
console.log(scenarioRunView.id);import os
from runloop_api_client import Runloop
client = Runloop(
bearer_token=os.environ.get("RUNLOOP_API_KEY"), # This is the default and can be omitted
)
scenario_run_view = client.scenarios.start_run(
scenario_id="scenario_id",
)
print(scenario_run_view.id)curl --request POST \
--url https://api.runloop.ai/v1/scenarios/start_run \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"scenario_id": "<string>",
"run_name": "<string>",
"benchmark_run_id": "<string>",
"metadata": {},
"runProfile": {
"purpose": "<string>",
"envVars": {},
"secrets": {},
"launchParameters": {
"launch_commands": [
"<string>"
],
"available_ports": [
123
],
"keep_alive_time_seconds": 123,
"after_idle": {
"idle_time_seconds": 123
},
"custom_cpu_cores": 123,
"custom_gb_memory": 123,
"custom_disk_size": 123,
"user_parameters": {
"username": "<string>",
"uid": 123
},
"required_services": [
"<string>"
],
"network_policy_id": "<string>",
"lifecycle": {
"after_idle": {
"idle_time_seconds": 123
},
"resume_triggers": {
"http": true,
"axon_event": true
},
"lifecycle_hooks": {
"suspend_commands": [
"<string>"
],
"suspend_deadline_ms": 123
}
}
},
"mounts": [
{
"object_id": "<string>",
"object_path": "<string>",
"type": "object_mount"
}
]
}
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.runloop.ai/v1/scenarios/start_run",
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([
'scenario_id' => '<string>',
'run_name' => '<string>',
'benchmark_run_id' => '<string>',
'metadata' => [
],
'runProfile' => [
'purpose' => '<string>',
'envVars' => [
],
'secrets' => [
],
'launchParameters' => [
'launch_commands' => [
'<string>'
],
'available_ports' => [
123
],
'keep_alive_time_seconds' => 123,
'after_idle' => [
'idle_time_seconds' => 123
],
'custom_cpu_cores' => 123,
'custom_gb_memory' => 123,
'custom_disk_size' => 123,
'user_parameters' => [
'username' => '<string>',
'uid' => 123
],
'required_services' => [
'<string>'
],
'network_policy_id' => '<string>',
'lifecycle' => [
'after_idle' => [
'idle_time_seconds' => 123
],
'resume_triggers' => [
'http' => true,
'axon_event' => true
],
'lifecycle_hooks' => [
'suspend_commands' => [
'<string>'
],
'suspend_deadline_ms' => 123
]
]
],
'mounts' => [
[
'object_id' => '<string>',
'object_path' => '<string>',
'type' => 'object_mount'
]
]
]
]),
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://api.runloop.ai/v1/scenarios/start_run"
payload := strings.NewReader("{\n \"scenario_id\": \"<string>\",\n \"run_name\": \"<string>\",\n \"benchmark_run_id\": \"<string>\",\n \"metadata\": {},\n \"runProfile\": {\n \"purpose\": \"<string>\",\n \"envVars\": {},\n \"secrets\": {},\n \"launchParameters\": {\n \"launch_commands\": [\n \"<string>\"\n ],\n \"available_ports\": [\n 123\n ],\n \"keep_alive_time_seconds\": 123,\n \"after_idle\": {\n \"idle_time_seconds\": 123\n },\n \"custom_cpu_cores\": 123,\n \"custom_gb_memory\": 123,\n \"custom_disk_size\": 123,\n \"user_parameters\": {\n \"username\": \"<string>\",\n \"uid\": 123\n },\n \"required_services\": [\n \"<string>\"\n ],\n \"network_policy_id\": \"<string>\",\n \"lifecycle\": {\n \"after_idle\": {\n \"idle_time_seconds\": 123\n },\n \"resume_triggers\": {\n \"http\": true,\n \"axon_event\": true\n },\n \"lifecycle_hooks\": {\n \"suspend_commands\": [\n \"<string>\"\n ],\n \"suspend_deadline_ms\": 123\n }\n }\n },\n \"mounts\": [\n {\n \"object_id\": \"<string>\",\n \"object_path\": \"<string>\",\n \"type\": \"object_mount\"\n }\n ]\n }\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://api.runloop.ai/v1/scenarios/start_run")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"scenario_id\": \"<string>\",\n \"run_name\": \"<string>\",\n \"benchmark_run_id\": \"<string>\",\n \"metadata\": {},\n \"runProfile\": {\n \"purpose\": \"<string>\",\n \"envVars\": {},\n \"secrets\": {},\n \"launchParameters\": {\n \"launch_commands\": [\n \"<string>\"\n ],\n \"available_ports\": [\n 123\n ],\n \"keep_alive_time_seconds\": 123,\n \"after_idle\": {\n \"idle_time_seconds\": 123\n },\n \"custom_cpu_cores\": 123,\n \"custom_gb_memory\": 123,\n \"custom_disk_size\": 123,\n \"user_parameters\": {\n \"username\": \"<string>\",\n \"uid\": 123\n },\n \"required_services\": [\n \"<string>\"\n ],\n \"network_policy_id\": \"<string>\",\n \"lifecycle\": {\n \"after_idle\": {\n \"idle_time_seconds\": 123\n },\n \"resume_triggers\": {\n \"http\": true,\n \"axon_event\": true\n },\n \"lifecycle_hooks\": {\n \"suspend_commands\": [\n \"<string>\"\n ],\n \"suspend_deadline_ms\": 123\n }\n }\n },\n \"mounts\": [\n {\n \"object_id\": \"<string>\",\n \"object_path\": \"<string>\",\n \"type\": \"object_mount\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.runloop.ai/v1/scenarios/start_run")
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 \"scenario_id\": \"<string>\",\n \"run_name\": \"<string>\",\n \"benchmark_run_id\": \"<string>\",\n \"metadata\": {},\n \"runProfile\": {\n \"purpose\": \"<string>\",\n \"envVars\": {},\n \"secrets\": {},\n \"launchParameters\": {\n \"launch_commands\": [\n \"<string>\"\n ],\n \"available_ports\": [\n 123\n ],\n \"keep_alive_time_seconds\": 123,\n \"after_idle\": {\n \"idle_time_seconds\": 123\n },\n \"custom_cpu_cores\": 123,\n \"custom_gb_memory\": 123,\n \"custom_disk_size\": 123,\n \"user_parameters\": {\n \"username\": \"<string>\",\n \"uid\": 123\n },\n \"required_services\": [\n \"<string>\"\n ],\n \"network_policy_id\": \"<string>\",\n \"lifecycle\": {\n \"after_idle\": {\n \"idle_time_seconds\": 123\n },\n \"resume_triggers\": {\n \"http\": true,\n \"axon_event\": true\n },\n \"lifecycle_hooks\": {\n \"suspend_commands\": [\n \"<string>\"\n ],\n \"suspend_deadline_ms\": 123\n }\n }\n },\n \"mounts\": [\n {\n \"object_id\": \"<string>\",\n \"object_path\": \"<string>\",\n \"type\": \"object_mount\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"scenario_id": "<string>",
"devbox_id": "<string>",
"metadata": {},
"name": "<string>",
"benchmark_run_id": "<string>",
"scoring_contract_result": {
"score": 123,
"scoring_function_results": [
{
"score": 123,
"scoring_function_name": "<string>",
"output": "<string>"
}
]
},
"start_time_ms": 123,
"duration_ms": 123,
"purpose": "<string>",
"environment_variables": {},
"secrets_provided": {}
}Start a new ScenarioRun.
Start a new ScenarioRun based on the provided Scenario.
import Runloop from '@runloop/api-client';
const client = new Runloop({
bearerToken: process.env['RUNLOOP_API_KEY'], // This is the default and can be omitted
});
const scenarioRunView = await client.scenarios.startRun({ scenario_id: 'scenario_id' });
console.log(scenarioRunView.id);import os
from runloop_api_client import Runloop
client = Runloop(
bearer_token=os.environ.get("RUNLOOP_API_KEY"), # This is the default and can be omitted
)
scenario_run_view = client.scenarios.start_run(
scenario_id="scenario_id",
)
print(scenario_run_view.id)curl --request POST \
--url https://api.runloop.ai/v1/scenarios/start_run \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"scenario_id": "<string>",
"run_name": "<string>",
"benchmark_run_id": "<string>",
"metadata": {},
"runProfile": {
"purpose": "<string>",
"envVars": {},
"secrets": {},
"launchParameters": {
"launch_commands": [
"<string>"
],
"available_ports": [
123
],
"keep_alive_time_seconds": 123,
"after_idle": {
"idle_time_seconds": 123
},
"custom_cpu_cores": 123,
"custom_gb_memory": 123,
"custom_disk_size": 123,
"user_parameters": {
"username": "<string>",
"uid": 123
},
"required_services": [
"<string>"
],
"network_policy_id": "<string>",
"lifecycle": {
"after_idle": {
"idle_time_seconds": 123
},
"resume_triggers": {
"http": true,
"axon_event": true
},
"lifecycle_hooks": {
"suspend_commands": [
"<string>"
],
"suspend_deadline_ms": 123
}
}
},
"mounts": [
{
"object_id": "<string>",
"object_path": "<string>",
"type": "object_mount"
}
]
}
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.runloop.ai/v1/scenarios/start_run",
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([
'scenario_id' => '<string>',
'run_name' => '<string>',
'benchmark_run_id' => '<string>',
'metadata' => [
],
'runProfile' => [
'purpose' => '<string>',
'envVars' => [
],
'secrets' => [
],
'launchParameters' => [
'launch_commands' => [
'<string>'
],
'available_ports' => [
123
],
'keep_alive_time_seconds' => 123,
'after_idle' => [
'idle_time_seconds' => 123
],
'custom_cpu_cores' => 123,
'custom_gb_memory' => 123,
'custom_disk_size' => 123,
'user_parameters' => [
'username' => '<string>',
'uid' => 123
],
'required_services' => [
'<string>'
],
'network_policy_id' => '<string>',
'lifecycle' => [
'after_idle' => [
'idle_time_seconds' => 123
],
'resume_triggers' => [
'http' => true,
'axon_event' => true
],
'lifecycle_hooks' => [
'suspend_commands' => [
'<string>'
],
'suspend_deadline_ms' => 123
]
]
],
'mounts' => [
[
'object_id' => '<string>',
'object_path' => '<string>',
'type' => 'object_mount'
]
]
]
]),
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://api.runloop.ai/v1/scenarios/start_run"
payload := strings.NewReader("{\n \"scenario_id\": \"<string>\",\n \"run_name\": \"<string>\",\n \"benchmark_run_id\": \"<string>\",\n \"metadata\": {},\n \"runProfile\": {\n \"purpose\": \"<string>\",\n \"envVars\": {},\n \"secrets\": {},\n \"launchParameters\": {\n \"launch_commands\": [\n \"<string>\"\n ],\n \"available_ports\": [\n 123\n ],\n \"keep_alive_time_seconds\": 123,\n \"after_idle\": {\n \"idle_time_seconds\": 123\n },\n \"custom_cpu_cores\": 123,\n \"custom_gb_memory\": 123,\n \"custom_disk_size\": 123,\n \"user_parameters\": {\n \"username\": \"<string>\",\n \"uid\": 123\n },\n \"required_services\": [\n \"<string>\"\n ],\n \"network_policy_id\": \"<string>\",\n \"lifecycle\": {\n \"after_idle\": {\n \"idle_time_seconds\": 123\n },\n \"resume_triggers\": {\n \"http\": true,\n \"axon_event\": true\n },\n \"lifecycle_hooks\": {\n \"suspend_commands\": [\n \"<string>\"\n ],\n \"suspend_deadline_ms\": 123\n }\n }\n },\n \"mounts\": [\n {\n \"object_id\": \"<string>\",\n \"object_path\": \"<string>\",\n \"type\": \"object_mount\"\n }\n ]\n }\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://api.runloop.ai/v1/scenarios/start_run")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"scenario_id\": \"<string>\",\n \"run_name\": \"<string>\",\n \"benchmark_run_id\": \"<string>\",\n \"metadata\": {},\n \"runProfile\": {\n \"purpose\": \"<string>\",\n \"envVars\": {},\n \"secrets\": {},\n \"launchParameters\": {\n \"launch_commands\": [\n \"<string>\"\n ],\n \"available_ports\": [\n 123\n ],\n \"keep_alive_time_seconds\": 123,\n \"after_idle\": {\n \"idle_time_seconds\": 123\n },\n \"custom_cpu_cores\": 123,\n \"custom_gb_memory\": 123,\n \"custom_disk_size\": 123,\n \"user_parameters\": {\n \"username\": \"<string>\",\n \"uid\": 123\n },\n \"required_services\": [\n \"<string>\"\n ],\n \"network_policy_id\": \"<string>\",\n \"lifecycle\": {\n \"after_idle\": {\n \"idle_time_seconds\": 123\n },\n \"resume_triggers\": {\n \"http\": true,\n \"axon_event\": true\n },\n \"lifecycle_hooks\": {\n \"suspend_commands\": [\n \"<string>\"\n ],\n \"suspend_deadline_ms\": 123\n }\n }\n },\n \"mounts\": [\n {\n \"object_id\": \"<string>\",\n \"object_path\": \"<string>\",\n \"type\": \"object_mount\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.runloop.ai/v1/scenarios/start_run")
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 \"scenario_id\": \"<string>\",\n \"run_name\": \"<string>\",\n \"benchmark_run_id\": \"<string>\",\n \"metadata\": {},\n \"runProfile\": {\n \"purpose\": \"<string>\",\n \"envVars\": {},\n \"secrets\": {},\n \"launchParameters\": {\n \"launch_commands\": [\n \"<string>\"\n ],\n \"available_ports\": [\n 123\n ],\n \"keep_alive_time_seconds\": 123,\n \"after_idle\": {\n \"idle_time_seconds\": 123\n },\n \"custom_cpu_cores\": 123,\n \"custom_gb_memory\": 123,\n \"custom_disk_size\": 123,\n \"user_parameters\": {\n \"username\": \"<string>\",\n \"uid\": 123\n },\n \"required_services\": [\n \"<string>\"\n ],\n \"network_policy_id\": \"<string>\",\n \"lifecycle\": {\n \"after_idle\": {\n \"idle_time_seconds\": 123\n },\n \"resume_triggers\": {\n \"http\": true,\n \"axon_event\": true\n },\n \"lifecycle_hooks\": {\n \"suspend_commands\": [\n \"<string>\"\n ],\n \"suspend_deadline_ms\": 123\n }\n }\n },\n \"mounts\": [\n {\n \"object_id\": \"<string>\",\n \"object_path\": \"<string>\",\n \"type\": \"object_mount\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"scenario_id": "<string>",
"devbox_id": "<string>",
"metadata": {},
"name": "<string>",
"benchmark_run_id": "<string>",
"scoring_contract_result": {
"score": 123,
"scoring_function_results": [
{
"score": 123,
"scoring_function_name": "<string>",
"output": "<string>"
}
]
},
"start_time_ms": 123,
"duration_ms": 123,
"purpose": "<string>",
"environment_variables": {},
"secrets_provided": {}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
ID of the Scenario to run.
Display name of the run.
Benchmark to associate the run.
User defined metadata to attach to the run for organization.
Show child attributes
Show child attributes
Runtime configuration to use for this benchmark run
Show child attributes
Show child attributes
Response
OK
A ScenarioRunView represents a single run of a Scenario on a Devbox. When completed, the ScenarioRun will contain the final score and output of the run.
ID of the ScenarioRun.
ID of the Scenario that has been run.
ID of the Devbox on which the Scenario is running.
The state of the ScenarioRun.
running, scoring, scored, completed, canceled, timeout, failed User defined metadata to attach to the scenario run for organization.
Show child attributes
Show child attributes
Optional name of ScenarioRun.
ID of the BenchmarkRun that this Scenario is associated with, if any.
The scoring result of the ScenarioRun.
Show child attributes
Show child attributes
The time that the scenario started
Duration scenario took to run.
Purpose of the ScenarioRun.
Environment variables used to run the scenario.
Show child attributes
Show child attributes
User secrets used to run the scenario.
Show child attributes
Show child attributes
Was this page helpful?
