curl --request POST \
--url https://api.example.com/v1/agent_sessions/{session_id}/tool_outputs \
--header 'Content-Type: application/json' \
--data '
{
"toolOutputs": [
{
"type": "<string>",
"toolCallId": "<string>",
"title": "<string>",
"state": "output-available",
"input": null,
"output": null,
"providerExecuted": true,
"callProviderMetadata": {},
"resultProviderMetadata": {},
"preliminary": true,
"approval": {
"id": "<string>"
}
}
],
"lastMessageId": "<string>"
}
'import requests
url = "https://api.example.com/v1/agent_sessions/{session_id}/tool_outputs"
payload = {
"toolOutputs": [
{
"type": "<string>",
"toolCallId": "<string>",
"title": "<string>",
"state": "output-available",
"input": None,
"output": None,
"providerExecuted": True,
"callProviderMetadata": {},
"resultProviderMetadata": {},
"preliminary": True,
"approval": { "id": "<string>" }
}
],
"lastMessageId": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
toolOutputs: [
{
type: '<string>',
toolCallId: '<string>',
title: '<string>',
state: 'output-available',
input: null,
output: null,
providerExecuted: true,
callProviderMetadata: {},
resultProviderMetadata: {},
preliminary: true,
approval: {id: '<string>'}
}
],
lastMessageId: '<string>'
})
};
fetch('https://api.example.com/v1/agent_sessions/{session_id}/tool_outputs', 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.example.com/v1/agent_sessions/{session_id}/tool_outputs",
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([
'toolOutputs' => [
[
'type' => '<string>',
'toolCallId' => '<string>',
'title' => '<string>',
'state' => 'output-available',
'input' => null,
'output' => null,
'providerExecuted' => true,
'callProviderMetadata' => [
],
'resultProviderMetadata' => [
],
'preliminary' => true,
'approval' => [
'id' => '<string>'
]
]
],
'lastMessageId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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.example.com/v1/agent_sessions/{session_id}/tool_outputs"
payload := strings.NewReader("{\n \"toolOutputs\": [\n {\n \"type\": \"<string>\",\n \"toolCallId\": \"<string>\",\n \"title\": \"<string>\",\n \"state\": \"output-available\",\n \"input\": null,\n \"output\": null,\n \"providerExecuted\": true,\n \"callProviderMetadata\": {},\n \"resultProviderMetadata\": {},\n \"preliminary\": true,\n \"approval\": {\n \"id\": \"<string>\"\n }\n }\n ],\n \"lastMessageId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/v1/agent_sessions/{session_id}/tool_outputs")
.header("Content-Type", "application/json")
.body("{\n \"toolOutputs\": [\n {\n \"type\": \"<string>\",\n \"toolCallId\": \"<string>\",\n \"title\": \"<string>\",\n \"state\": \"output-available\",\n \"input\": null,\n \"output\": null,\n \"providerExecuted\": true,\n \"callProviderMetadata\": {},\n \"resultProviderMetadata\": {},\n \"preliminary\": true,\n \"approval\": {\n \"id\": \"<string>\"\n }\n }\n ],\n \"lastMessageId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/agent_sessions/{session_id}/tool_outputs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"toolOutputs\": [\n {\n \"type\": \"<string>\",\n \"toolCallId\": \"<string>\",\n \"title\": \"<string>\",\n \"state\": \"output-available\",\n \"input\": null,\n \"output\": null,\n \"providerExecuted\": true,\n \"callProviderMetadata\": {},\n \"resultProviderMetadata\": {},\n \"preliminary\": true,\n \"approval\": {\n \"id\": \"<string>\"\n }\n }\n ],\n \"lastMessageId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"parts": [
{
"text": "<string>",
"type": "text",
"providerMetadata": {}
}
],
"metadata": {
"phoenix": {
"type": "assistant",
"sessionId": "<string>",
"turnTraceContext": {
"traceId": "<string>",
"rootSpanId": "<string>",
"startedAt": "2023-11-07T05:31:56Z"
},
"usage": {
"tokens": {
"prompt": 123,
"completion": 123,
"total": 123
},
"promptDetails": {
"cacheRead": 123,
"cacheWrite": 123
}
},
"interrupted": false
},
"pydantic_ai": {
"timestamp": "2023-11-07T05:31:56Z"
}
}
}
}"<string>""<string>""<string>""<string>"{
"message": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}"<string>"Submit Agent Session Tool Outputs
Persist resolved client tool outputs for the session’s open turn.
curl --request POST \
--url https://api.example.com/v1/agent_sessions/{session_id}/tool_outputs \
--header 'Content-Type: application/json' \
--data '
{
"toolOutputs": [
{
"type": "<string>",
"toolCallId": "<string>",
"title": "<string>",
"state": "output-available",
"input": null,
"output": null,
"providerExecuted": true,
"callProviderMetadata": {},
"resultProviderMetadata": {},
"preliminary": true,
"approval": {
"id": "<string>"
}
}
],
"lastMessageId": "<string>"
}
'import requests
url = "https://api.example.com/v1/agent_sessions/{session_id}/tool_outputs"
payload = {
"toolOutputs": [
{
"type": "<string>",
"toolCallId": "<string>",
"title": "<string>",
"state": "output-available",
"input": None,
"output": None,
"providerExecuted": True,
"callProviderMetadata": {},
"resultProviderMetadata": {},
"preliminary": True,
"approval": { "id": "<string>" }
}
],
"lastMessageId": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
toolOutputs: [
{
type: '<string>',
toolCallId: '<string>',
title: '<string>',
state: 'output-available',
input: null,
output: null,
providerExecuted: true,
callProviderMetadata: {},
resultProviderMetadata: {},
preliminary: true,
approval: {id: '<string>'}
}
],
lastMessageId: '<string>'
})
};
fetch('https://api.example.com/v1/agent_sessions/{session_id}/tool_outputs', 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.example.com/v1/agent_sessions/{session_id}/tool_outputs",
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([
'toolOutputs' => [
[
'type' => '<string>',
'toolCallId' => '<string>',
'title' => '<string>',
'state' => 'output-available',
'input' => null,
'output' => null,
'providerExecuted' => true,
'callProviderMetadata' => [
],
'resultProviderMetadata' => [
],
'preliminary' => true,
'approval' => [
'id' => '<string>'
]
]
],
'lastMessageId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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.example.com/v1/agent_sessions/{session_id}/tool_outputs"
payload := strings.NewReader("{\n \"toolOutputs\": [\n {\n \"type\": \"<string>\",\n \"toolCallId\": \"<string>\",\n \"title\": \"<string>\",\n \"state\": \"output-available\",\n \"input\": null,\n \"output\": null,\n \"providerExecuted\": true,\n \"callProviderMetadata\": {},\n \"resultProviderMetadata\": {},\n \"preliminary\": true,\n \"approval\": {\n \"id\": \"<string>\"\n }\n }\n ],\n \"lastMessageId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/v1/agent_sessions/{session_id}/tool_outputs")
.header("Content-Type", "application/json")
.body("{\n \"toolOutputs\": [\n {\n \"type\": \"<string>\",\n \"toolCallId\": \"<string>\",\n \"title\": \"<string>\",\n \"state\": \"output-available\",\n \"input\": null,\n \"output\": null,\n \"providerExecuted\": true,\n \"callProviderMetadata\": {},\n \"resultProviderMetadata\": {},\n \"preliminary\": true,\n \"approval\": {\n \"id\": \"<string>\"\n }\n }\n ],\n \"lastMessageId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/agent_sessions/{session_id}/tool_outputs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"toolOutputs\": [\n {\n \"type\": \"<string>\",\n \"toolCallId\": \"<string>\",\n \"title\": \"<string>\",\n \"state\": \"output-available\",\n \"input\": null,\n \"output\": null,\n \"providerExecuted\": true,\n \"callProviderMetadata\": {},\n \"resultProviderMetadata\": {},\n \"preliminary\": true,\n \"approval\": {\n \"id\": \"<string>\"\n }\n }\n ],\n \"lastMessageId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"parts": [
{
"text": "<string>",
"type": "text",
"providerMetadata": {}
}
],
"metadata": {
"phoenix": {
"type": "assistant",
"sessionId": "<string>",
"turnTraceContext": {
"traceId": "<string>",
"rootSpanId": "<string>",
"startedAt": "2023-11-07T05:31:56Z"
},
"usage": {
"tokens": {
"prompt": 123,
"completion": 123,
"total": 123
},
"promptDetails": {
"cacheRead": 123,
"cacheWrite": 123
}
},
"interrupted": false
},
"pydantic_ai": {
"timestamp": "2023-11-07T05:31:56Z"
}
}
}
}"<string>""<string>""<string>""<string>"{
"message": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}"<string>"Path Parameters
Body
Persist resolved client tool outputs without continuing the turn.
Client tool results for pending calls on the trailing assistant message, matched by toolCallId. Resending a persisted output verbatim is a no-op; an output that differs from the persisted result or matches no call is rejected with HTTP 409 and code agent_session_tool_outputs_conflict.
1Tool part in output-available state.
- ToolOutputAvailablePart
- ToolOutputErrorPart
- DynamicToolOutputAvailablePart
- DynamicToolOutputErrorPart
Show child attributes
Show child attributes
The trailing assistant message's id. On mismatch the submission is rejected with HTTP 409 and code agent_session_messages_stale.
Response
Successful Response
The trailing assistant message with the submitted outputs applied.
UIMessage with metadata narrowed to the Phoenix wire shapes.
Show child attributes
Show child attributes
Was this page helpful?

