curl --request PATCH \
--url https://api.example.com/sessions/{session_id} \
--header 'Content-Type: application/json' \
--header 'x-user-id: <x-user-id>' \
--data '
{
"name": "<string>",
"chat_model_config": {
"type": "<string>",
"credential_id": "<string>",
"model": "<string>",
"parameters": {}
},
"fallback_chat_model_config": {
"type": "<string>",
"credential_id": "<string>",
"model": "<string>",
"parameters": {}
}
}
'import requests
url = "https://api.example.com/sessions/{session_id}"
payload = {
"name": "<string>",
"chat_model_config": {
"type": "<string>",
"credential_id": "<string>",
"model": "<string>",
"parameters": {}
},
"fallback_chat_model_config": {
"type": "<string>",
"credential_id": "<string>",
"model": "<string>",
"parameters": {}
}
}
headers = {
"x-user-id": "<x-user-id>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'x-user-id': '<x-user-id>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
chat_model_config: {type: '<string>', credential_id: '<string>', model: '<string>', parameters: {}},
fallback_chat_model_config: {type: '<string>', credential_id: '<string>', model: '<string>', parameters: {}}
})
};
fetch('https://api.example.com/sessions/{session_id}', 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/sessions/{session_id}",
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([
'name' => '<string>',
'chat_model_config' => [
'type' => '<string>',
'credential_id' => '<string>',
'model' => '<string>',
'parameters' => [
]
],
'fallback_chat_model_config' => [
'type' => '<string>',
'credential_id' => '<string>',
'model' => '<string>',
'parameters' => [
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-user-id: <x-user-id>"
],
]);
$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/sessions/{session_id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"chat_model_config\": {\n \"type\": \"<string>\",\n \"credential_id\": \"<string>\",\n \"model\": \"<string>\",\n \"parameters\": {}\n },\n \"fallback_chat_model_config\": {\n \"type\": \"<string>\",\n \"credential_id\": \"<string>\",\n \"model\": \"<string>\",\n \"parameters\": {}\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-user-id", "<x-user-id>")
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.example.com/sessions/{session_id}")
.header("x-user-id", "<x-user-id>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"chat_model_config\": {\n \"type\": \"<string>\",\n \"credential_id\": \"<string>\",\n \"model\": \"<string>\",\n \"parameters\": {}\n },\n \"fallback_chat_model_config\": {\n \"type\": \"<string>\",\n \"credential_id\": \"<string>\",\n \"model\": \"<string>\",\n \"parameters\": {}\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/sessions/{session_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-user-id"] = '<x-user-id>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"chat_model_config\": {\n \"type\": \"<string>\",\n \"credential_id\": \"<string>\",\n \"model\": \"<string>\",\n \"parameters\": {}\n },\n \"fallback_chat_model_config\": {\n \"type\": \"<string>\",\n \"credential_id\": \"<string>\",\n \"model\": \"<string>\",\n \"parameters\": {}\n }\n}"
response = http.request(request)
puts response.read_body{
"user_id": "<string>",
"agent_id": "<string>",
"config": {
"workspace_id": "<string>",
"name": "<string>",
"chat_model_config": {
"type": "<string>",
"credential_id": "<string>",
"model": "<string>",
"parameters": {}
},
"fallback_chat_model_config": {
"type": "<string>",
"credential_id": "<string>",
"model": "<string>",
"parameters": {}
}
},
"id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"source": "user",
"source_schedule_id": "<string>",
"team_id": "<string>",
"state": {
"session_id": "<string>",
"summary": "",
"context": [
{
"name": "<string>",
"content": [
{
"text": "<string>",
"type": "text",
"id": "<string>"
}
],
"id": "<string>",
"metadata": {},
"created_at": "<string>",
"finished_at": "<string>",
"usage": {
"input_tokens": 123,
"output_tokens": 123
}
}
],
"reply_id": "<string>",
"cur_iter": 0,
"permission_context": {
"mode": "default",
"working_directories": {},
"allow_rules": {},
"deny_rules": {},
"ask_rules": {}
},
"tool_context": {
"max_cache_files": 100,
"max_cache_bytes": 25000,
"read_file_cache": [
{
"lines": [
"<string>"
],
"updated_at": 123,
"bytes": 123,
"file_path": "<string>"
}
],
"activated_groups": [
"<string>"
]
},
"tasks_context": {
"tasks": [
{
"subject": "<string>",
"description": "<string>",
"metadata": {},
"created_at": "<string>",
"state": "pending",
"id": "<string>",
"owner": "<string>",
"blocks": [
"<string>"
],
"blocked_by": [
"<string>"
]
}
]
}
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Update a session
Update the model configuration of an existing session.
Args:
session_id (str): The session to update.
body (UpdateSessionRequest): Fields to update.
user_id (str): Injected authenticated user ID.
storage (StorageBase): Injected storage backend.
Returns:
SessionRecord: The full session record after the update.
Raises:
HTTPException: 404 if the session, agent, or credential does not
exist or does not belong to the authenticated user.
curl --request PATCH \
--url https://api.example.com/sessions/{session_id} \
--header 'Content-Type: application/json' \
--header 'x-user-id: <x-user-id>' \
--data '
{
"name": "<string>",
"chat_model_config": {
"type": "<string>",
"credential_id": "<string>",
"model": "<string>",
"parameters": {}
},
"fallback_chat_model_config": {
"type": "<string>",
"credential_id": "<string>",
"model": "<string>",
"parameters": {}
}
}
'import requests
url = "https://api.example.com/sessions/{session_id}"
payload = {
"name": "<string>",
"chat_model_config": {
"type": "<string>",
"credential_id": "<string>",
"model": "<string>",
"parameters": {}
},
"fallback_chat_model_config": {
"type": "<string>",
"credential_id": "<string>",
"model": "<string>",
"parameters": {}
}
}
headers = {
"x-user-id": "<x-user-id>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'x-user-id': '<x-user-id>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
chat_model_config: {type: '<string>', credential_id: '<string>', model: '<string>', parameters: {}},
fallback_chat_model_config: {type: '<string>', credential_id: '<string>', model: '<string>', parameters: {}}
})
};
fetch('https://api.example.com/sessions/{session_id}', 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/sessions/{session_id}",
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([
'name' => '<string>',
'chat_model_config' => [
'type' => '<string>',
'credential_id' => '<string>',
'model' => '<string>',
'parameters' => [
]
],
'fallback_chat_model_config' => [
'type' => '<string>',
'credential_id' => '<string>',
'model' => '<string>',
'parameters' => [
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-user-id: <x-user-id>"
],
]);
$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/sessions/{session_id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"chat_model_config\": {\n \"type\": \"<string>\",\n \"credential_id\": \"<string>\",\n \"model\": \"<string>\",\n \"parameters\": {}\n },\n \"fallback_chat_model_config\": {\n \"type\": \"<string>\",\n \"credential_id\": \"<string>\",\n \"model\": \"<string>\",\n \"parameters\": {}\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-user-id", "<x-user-id>")
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.example.com/sessions/{session_id}")
.header("x-user-id", "<x-user-id>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"chat_model_config\": {\n \"type\": \"<string>\",\n \"credential_id\": \"<string>\",\n \"model\": \"<string>\",\n \"parameters\": {}\n },\n \"fallback_chat_model_config\": {\n \"type\": \"<string>\",\n \"credential_id\": \"<string>\",\n \"model\": \"<string>\",\n \"parameters\": {}\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/sessions/{session_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-user-id"] = '<x-user-id>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"chat_model_config\": {\n \"type\": \"<string>\",\n \"credential_id\": \"<string>\",\n \"model\": \"<string>\",\n \"parameters\": {}\n },\n \"fallback_chat_model_config\": {\n \"type\": \"<string>\",\n \"credential_id\": \"<string>\",\n \"model\": \"<string>\",\n \"parameters\": {}\n }\n}"
response = http.request(request)
puts response.read_body{
"user_id": "<string>",
"agent_id": "<string>",
"config": {
"workspace_id": "<string>",
"name": "<string>",
"chat_model_config": {
"type": "<string>",
"credential_id": "<string>",
"model": "<string>",
"parameters": {}
},
"fallback_chat_model_config": {
"type": "<string>",
"credential_id": "<string>",
"model": "<string>",
"parameters": {}
}
},
"id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"source": "user",
"source_schedule_id": "<string>",
"team_id": "<string>",
"state": {
"session_id": "<string>",
"summary": "",
"context": [
{
"name": "<string>",
"content": [
{
"text": "<string>",
"type": "text",
"id": "<string>"
}
],
"id": "<string>",
"metadata": {},
"created_at": "<string>",
"finished_at": "<string>",
"usage": {
"input_tokens": 123,
"output_tokens": 123
}
}
],
"reply_id": "<string>",
"cur_iter": 0,
"permission_context": {
"mode": "default",
"working_directories": {},
"allow_rules": {},
"deny_rules": {},
"ask_rules": {}
},
"tool_context": {
"max_cache_files": 100,
"max_cache_bytes": 25000,
"read_file_cache": [
{
"lines": [
"<string>"
],
"updated_at": 123,
"bytes": 123,
"file_path": "<string>"
}
],
"activated_groups": [
"<string>"
]
},
"tasks_context": {
"tasks": [
{
"subject": "<string>",
"description": "<string>",
"metadata": {},
"created_at": "<string>",
"state": "pending",
"id": "<string>",
"owner": "<string>",
"blocks": [
"<string>"
],
"blocked_by": [
"<string>"
]
}
]
}
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Headers
Caller's user ID. Temporary header-based identity; will be replaced by JWT auth.
Path Parameters
Query Parameters
Agent the session belongs to.
Body
Request body for updating an existing session.
Omit any field to keep its current value.
New display name.
New model configuration. Replaces the existing one entirely. Pass null to clear; omit to leave unchanged.
Show child attributes
Show child attributes
New fallback model configuration. Pass null to clear; omit to leave unchanged.
Show child attributes
Show child attributes
New permission mode for the session.
default, accept_edits, explore, bypass, dont_ask Response
Successful Response
The session record.
Session configuration — set at creation, updatable via PATCH.
Show child attributes
Show child attributes
Unique identifier for the credential.
The source that created the session.
user, schedule The agent state that should be saved and loaded from storage.
Show child attributes
Show child attributes