Run an agent (streaming or one-shot)
curl --request POST \
--url https://api.runtools.ai/v1/run \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent": "<string>",
"prompt": "<string>",
"stream": true,
"messages": [
{
"content": "<string>",
"parts": [
{
"type": "text",
"text": "<string>"
}
]
}
],
"threadId": "<string>",
"config": {
"maxTokens": 123,
"maxTurns": 123,
"temperature": 123
},
"metadata": {}
}
'import requests
url = "https://api.runtools.ai/v1/run"
payload = {
"agent": "<string>",
"prompt": "<string>",
"stream": True,
"messages": [
{
"content": "<string>",
"parts": [
{
"type": "text",
"text": "<string>"
}
]
}
],
"threadId": "<string>",
"config": {
"maxTokens": 123,
"maxTurns": 123,
"temperature": 123
},
"metadata": {}
}
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({
agent: '<string>',
prompt: '<string>',
stream: true,
messages: [{content: '<string>', parts: [{type: 'text', text: '<string>'}]}],
threadId: '<string>',
config: {maxTokens: 123, maxTurns: 123, temperature: 123},
metadata: {}
})
};
fetch('https://api.runtools.ai/v1/run', 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.runtools.ai/v1/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([
'agent' => '<string>',
'prompt' => '<string>',
'stream' => true,
'messages' => [
[
'content' => '<string>',
'parts' => [
[
'type' => 'text',
'text' => '<string>'
]
]
]
],
'threadId' => '<string>',
'config' => [
'maxTokens' => 123,
'maxTurns' => 123,
'temperature' => 123
],
'metadata' => [
]
]),
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.runtools.ai/v1/run"
payload := strings.NewReader("{\n \"agent\": \"<string>\",\n \"prompt\": \"<string>\",\n \"stream\": true,\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"parts\": [\n {\n \"type\": \"text\",\n \"text\": \"<string>\"\n }\n ]\n }\n ],\n \"threadId\": \"<string>\",\n \"config\": {\n \"maxTokens\": 123,\n \"maxTurns\": 123,\n \"temperature\": 123\n },\n \"metadata\": {}\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.runtools.ai/v1/run")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent\": \"<string>\",\n \"prompt\": \"<string>\",\n \"stream\": true,\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"parts\": [\n {\n \"type\": \"text\",\n \"text\": \"<string>\"\n }\n ]\n }\n ],\n \"threadId\": \"<string>\",\n \"config\": {\n \"maxTokens\": 123,\n \"maxTurns\": 123,\n \"temperature\": 123\n },\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.runtools.ai/v1/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 \"agent\": \"<string>\",\n \"prompt\": \"<string>\",\n \"stream\": true,\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"parts\": [\n {\n \"type\": \"text\",\n \"text\": \"<string>\"\n }\n ]\n }\n ],\n \"threadId\": \"<string>\",\n \"config\": {\n \"maxTokens\": 123,\n \"maxTurns\": 123,\n \"temperature\": 123\n },\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"data": {
"runId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sandboxId": "<string>",
"threadId": "<string>",
"rolloutId": "<string>",
"targetDeviceId": "<string>",
"result": "<unknown>",
"usage": {
"promptTokens": 123,
"completionTokens": 123,
"totalTokens": 123,
"inputTokens": 123,
"outputTokens": 123,
"cachedInputTokens": 123,
"reasoningTokens": 123
},
"iterations": 123
}
}Agent runs
Run an agent (streaming or one-shot)
Dispatches an agent run by executionMode:
in_sandbox— routes through the linked sandbox runtime.managed— routes intoruntools-model-gateway.local-mac— registers and dispatches through RunMesh to the bound device. Streaming responses aretext/event-stream(SSE) with RunTools agent event frames. Non-streaming returns JSON when complete.
POST
/
v1
/
run
Run an agent (streaming or one-shot)
curl --request POST \
--url https://api.runtools.ai/v1/run \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent": "<string>",
"prompt": "<string>",
"stream": true,
"messages": [
{
"content": "<string>",
"parts": [
{
"type": "text",
"text": "<string>"
}
]
}
],
"threadId": "<string>",
"config": {
"maxTokens": 123,
"maxTurns": 123,
"temperature": 123
},
"metadata": {}
}
'import requests
url = "https://api.runtools.ai/v1/run"
payload = {
"agent": "<string>",
"prompt": "<string>",
"stream": True,
"messages": [
{
"content": "<string>",
"parts": [
{
"type": "text",
"text": "<string>"
}
]
}
],
"threadId": "<string>",
"config": {
"maxTokens": 123,
"maxTurns": 123,
"temperature": 123
},
"metadata": {}
}
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({
agent: '<string>',
prompt: '<string>',
stream: true,
messages: [{content: '<string>', parts: [{type: 'text', text: '<string>'}]}],
threadId: '<string>',
config: {maxTokens: 123, maxTurns: 123, temperature: 123},
metadata: {}
})
};
fetch('https://api.runtools.ai/v1/run', 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.runtools.ai/v1/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([
'agent' => '<string>',
'prompt' => '<string>',
'stream' => true,
'messages' => [
[
'content' => '<string>',
'parts' => [
[
'type' => 'text',
'text' => '<string>'
]
]
]
],
'threadId' => '<string>',
'config' => [
'maxTokens' => 123,
'maxTurns' => 123,
'temperature' => 123
],
'metadata' => [
]
]),
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.runtools.ai/v1/run"
payload := strings.NewReader("{\n \"agent\": \"<string>\",\n \"prompt\": \"<string>\",\n \"stream\": true,\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"parts\": [\n {\n \"type\": \"text\",\n \"text\": \"<string>\"\n }\n ]\n }\n ],\n \"threadId\": \"<string>\",\n \"config\": {\n \"maxTokens\": 123,\n \"maxTurns\": 123,\n \"temperature\": 123\n },\n \"metadata\": {}\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.runtools.ai/v1/run")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent\": \"<string>\",\n \"prompt\": \"<string>\",\n \"stream\": true,\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"parts\": [\n {\n \"type\": \"text\",\n \"text\": \"<string>\"\n }\n ]\n }\n ],\n \"threadId\": \"<string>\",\n \"config\": {\n \"maxTokens\": 123,\n \"maxTurns\": 123,\n \"temperature\": 123\n },\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.runtools.ai/v1/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 \"agent\": \"<string>\",\n \"prompt\": \"<string>\",\n \"stream\": true,\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"parts\": [\n {\n \"type\": \"text\",\n \"text\": \"<string>\"\n }\n ]\n }\n ],\n \"threadId\": \"<string>\",\n \"config\": {\n \"maxTokens\": 123,\n \"maxTurns\": 123,\n \"temperature\": 123\n },\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"data": {
"runId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sandboxId": "<string>",
"threadId": "<string>",
"rolloutId": "<string>",
"targetDeviceId": "<string>",
"result": "<unknown>",
"usage": {
"promptTokens": 123,
"completionTokens": 123,
"totalTokens": 123,
"inputTokens": 123,
"outputTokens": 123,
"cachedInputTokens": 123,
"reasoningTokens": 123
},
"iterations": 123
}
}Authorizations
bearerapiKey
WorkOS session token or RunTools API key (rt_live_* / rt_test_*).
Used in Authorization: Bearer <token> header.
Body
application/json
Response
Run completed (non-streaming) or registered (local-mac caller).
Show child attributes
Show child attributes
⌘I