Submit a tool result
curl --request POST \
--url http://127.0.0.1:8400/v1/tool_calls/{id}/result \
--header 'Content-Type: application/json' \
--header 'X-Session-Secret: <api-key>' \
--data '
{
"output": "<string>",
"is_error": false
}
'import requests
url = "http://127.0.0.1:8400/v1/tool_calls/{id}/result"
payload = {
"output": "<string>",
"is_error": False
}
headers = {
"X-Session-Secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Session-Secret': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({output: '<string>', is_error: false})
};
fetch('http://127.0.0.1:8400/v1/tool_calls/{id}/result', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8400",
CURLOPT_URL => "http://127.0.0.1:8400/v1/tool_calls/{id}/result",
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([
'output' => '<string>',
'is_error' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Session-Secret: <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 := "http://127.0.0.1:8400/v1/tool_calls/{id}/result"
payload := strings.NewReader("{\n \"output\": \"<string>\",\n \"is_error\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Session-Secret", "<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.post("http://127.0.0.1:8400/v1/tool_calls/{id}/result")
.header("X-Session-Secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"output\": \"<string>\",\n \"is_error\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://127.0.0.1:8400/v1/tool_calls/{id}/result")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["X-Session-Secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"output\": \"<string>\",\n \"is_error\": false\n}"
response = http.request(request)
puts response.read_body{
"tool_call_id": "<string>",
"status": "completed"
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "model_not_mapped",
"tool": "<string>",
"clashes_with": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "model_not_mapped",
"tool": "<string>",
"clashes_with": "<string>"
}
}Tool calls
Submit a tool result
Posts the output of a tool call. Sending the same id again stores nothing new and returns 200 (idempotent on tool_call_id). Output over 100 KiB is refused with 413 result_too_large; the worker should truncate and retry with is_error as needed. Auth is the session secret of the session that owns the call.
POST
/
v1
/
tool_calls
/
{id}
/
result
Submit a tool result
curl --request POST \
--url http://127.0.0.1:8400/v1/tool_calls/{id}/result \
--header 'Content-Type: application/json' \
--header 'X-Session-Secret: <api-key>' \
--data '
{
"output": "<string>",
"is_error": false
}
'import requests
url = "http://127.0.0.1:8400/v1/tool_calls/{id}/result"
payload = {
"output": "<string>",
"is_error": False
}
headers = {
"X-Session-Secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Session-Secret': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({output: '<string>', is_error: false})
};
fetch('http://127.0.0.1:8400/v1/tool_calls/{id}/result', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8400",
CURLOPT_URL => "http://127.0.0.1:8400/v1/tool_calls/{id}/result",
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([
'output' => '<string>',
'is_error' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Session-Secret: <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 := "http://127.0.0.1:8400/v1/tool_calls/{id}/result"
payload := strings.NewReader("{\n \"output\": \"<string>\",\n \"is_error\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Session-Secret", "<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.post("http://127.0.0.1:8400/v1/tool_calls/{id}/result")
.header("X-Session-Secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"output\": \"<string>\",\n \"is_error\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://127.0.0.1:8400/v1/tool_calls/{id}/result")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["X-Session-Secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"output\": \"<string>\",\n \"is_error\": false\n}"
response = http.request(request)
puts response.read_body{
"tool_call_id": "<string>",
"status": "completed"
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "model_not_mapped",
"tool": "<string>",
"clashes_with": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "model_not_mapped",
"tool": "<string>",
"clashes_with": "<string>"
}
}Authorizations
Body
application/json