Session
Create session
Creates a new session in a given namespace
POST
/
api
/
v1
/
local
/
session
Create session
curl --request POST \
--url https://api.example.com/api/v1/local/session \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agentGraphRequest": {
"agents": [
{
"id": {
"name": "<string>",
"version": "<string>",
"registrySourceId": {
"type": "linked",
"linkedServerId": "<string>"
}
},
"name": "<string>",
"provider": {
"type": "linked",
"linkedServerName": "<string>"
},
"proxies": {},
"description": "<string>",
"options": {},
"systemPrompt": "<string>",
"blocking": true,
"customToolAccess": [
"<string>"
],
"plugins": [
{
"type": "close_session_tool"
}
],
"x402Budgets": [
{
"priority": 123,
"resource": "<string>",
"remainingBudget": 123
}
],
"annotations": {}
}
],
"groups": [
[
"<string>"
]
],
"customTools": {}
},
"namespaceProvider": {
"type": "create_if_not_exists",
"namespaceRequest": {
"name": "<string>",
"deleteOnLastSessionExit": true,
"annotations": {}
}
},
"execution": {
"mode": "defer"
},
"annotations": {}
}
'import requests
url = "https://api.example.com/api/v1/local/session"
payload = {
"agentGraphRequest": {
"agents": [
{
"id": {
"name": "<string>",
"version": "<string>",
"registrySourceId": {
"type": "linked",
"linkedServerId": "<string>"
}
},
"name": "<string>",
"provider": {
"type": "linked",
"linkedServerName": "<string>"
},
"proxies": {},
"description": "<string>",
"options": {},
"systemPrompt": "<string>",
"blocking": True,
"customToolAccess": ["<string>"],
"plugins": [{ "type": "close_session_tool" }],
"x402Budgets": [
{
"priority": 123,
"resource": "<string>",
"remainingBudget": 123
}
],
"annotations": {}
}
],
"groups": [["<string>"]],
"customTools": {}
},
"namespaceProvider": {
"type": "create_if_not_exists",
"namespaceRequest": {
"name": "<string>",
"deleteOnLastSessionExit": True,
"annotations": {}
}
},
"execution": { "mode": "defer" },
"annotations": {}
}
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({
agentGraphRequest: {
agents: [
{
id: {
name: '<string>',
version: '<string>',
registrySourceId: {type: 'linked', linkedServerId: '<string>'}
},
name: '<string>',
provider: {type: 'linked', linkedServerName: '<string>'},
proxies: {},
description: '<string>',
options: {},
systemPrompt: '<string>',
blocking: true,
customToolAccess: ['<string>'],
plugins: [{type: 'close_session_tool'}],
x402Budgets: [{priority: 123, resource: '<string>', remainingBudget: 123}],
annotations: {}
}
],
groups: [['<string>']],
customTools: {}
},
namespaceProvider: {
type: 'create_if_not_exists',
namespaceRequest: {name: '<string>', deleteOnLastSessionExit: true, annotations: {}}
},
execution: {mode: 'defer'},
annotations: {}
})
};
fetch('https://api.example.com/api/v1/local/session', 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/api/v1/local/session",
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([
'agentGraphRequest' => [
'agents' => [
[
'id' => [
'name' => '<string>',
'version' => '<string>',
'registrySourceId' => [
'type' => 'linked',
'linkedServerId' => '<string>'
]
],
'name' => '<string>',
'provider' => [
'type' => 'linked',
'linkedServerName' => '<string>'
],
'proxies' => [
],
'description' => '<string>',
'options' => [
],
'systemPrompt' => '<string>',
'blocking' => true,
'customToolAccess' => [
'<string>'
],
'plugins' => [
[
'type' => 'close_session_tool'
]
],
'x402Budgets' => [
[
'priority' => 123,
'resource' => '<string>',
'remainingBudget' => 123
]
],
'annotations' => [
]
]
],
'groups' => [
[
'<string>'
]
],
'customTools' => [
]
],
'namespaceProvider' => [
'type' => 'create_if_not_exists',
'namespaceRequest' => [
'name' => '<string>',
'deleteOnLastSessionExit' => true,
'annotations' => [
]
]
],
'execution' => [
'mode' => 'defer'
],
'annotations' => [
]
]),
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.example.com/api/v1/local/session"
payload := strings.NewReader("{\n \"agentGraphRequest\": {\n \"agents\": [\n {\n \"id\": {\n \"name\": \"<string>\",\n \"version\": \"<string>\",\n \"registrySourceId\": {\n \"type\": \"linked\",\n \"linkedServerId\": \"<string>\"\n }\n },\n \"name\": \"<string>\",\n \"provider\": {\n \"type\": \"linked\",\n \"linkedServerName\": \"<string>\"\n },\n \"proxies\": {},\n \"description\": \"<string>\",\n \"options\": {},\n \"systemPrompt\": \"<string>\",\n \"blocking\": true,\n \"customToolAccess\": [\n \"<string>\"\n ],\n \"plugins\": [\n {\n \"type\": \"close_session_tool\"\n }\n ],\n \"x402Budgets\": [\n {\n \"priority\": 123,\n \"resource\": \"<string>\",\n \"remainingBudget\": 123\n }\n ],\n \"annotations\": {}\n }\n ],\n \"groups\": [\n [\n \"<string>\"\n ]\n ],\n \"customTools\": {}\n },\n \"namespaceProvider\": {\n \"type\": \"create_if_not_exists\",\n \"namespaceRequest\": {\n \"name\": \"<string>\",\n \"deleteOnLastSessionExit\": true,\n \"annotations\": {}\n }\n },\n \"execution\": {\n \"mode\": \"defer\"\n },\n \"annotations\": {}\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.example.com/api/v1/local/session")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agentGraphRequest\": {\n \"agents\": [\n {\n \"id\": {\n \"name\": \"<string>\",\n \"version\": \"<string>\",\n \"registrySourceId\": {\n \"type\": \"linked\",\n \"linkedServerId\": \"<string>\"\n }\n },\n \"name\": \"<string>\",\n \"provider\": {\n \"type\": \"linked\",\n \"linkedServerName\": \"<string>\"\n },\n \"proxies\": {},\n \"description\": \"<string>\",\n \"options\": {},\n \"systemPrompt\": \"<string>\",\n \"blocking\": true,\n \"customToolAccess\": [\n \"<string>\"\n ],\n \"plugins\": [\n {\n \"type\": \"close_session_tool\"\n }\n ],\n \"x402Budgets\": [\n {\n \"priority\": 123,\n \"resource\": \"<string>\",\n \"remainingBudget\": 123\n }\n ],\n \"annotations\": {}\n }\n ],\n \"groups\": [\n [\n \"<string>\"\n ]\n ],\n \"customTools\": {}\n },\n \"namespaceProvider\": {\n \"type\": \"create_if_not_exists\",\n \"namespaceRequest\": {\n \"name\": \"<string>\",\n \"deleteOnLastSessionExit\": true,\n \"annotations\": {}\n }\n },\n \"execution\": {\n \"mode\": \"defer\"\n },\n \"annotations\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/local/session")
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 \"agentGraphRequest\": {\n \"agents\": [\n {\n \"id\": {\n \"name\": \"<string>\",\n \"version\": \"<string>\",\n \"registrySourceId\": {\n \"type\": \"linked\",\n \"linkedServerId\": \"<string>\"\n }\n },\n \"name\": \"<string>\",\n \"provider\": {\n \"type\": \"linked\",\n \"linkedServerName\": \"<string>\"\n },\n \"proxies\": {},\n \"description\": \"<string>\",\n \"options\": {},\n \"systemPrompt\": \"<string>\",\n \"blocking\": true,\n \"customToolAccess\": [\n \"<string>\"\n ],\n \"plugins\": [\n {\n \"type\": \"close_session_tool\"\n }\n ],\n \"x402Budgets\": [\n {\n \"priority\": 123,\n \"resource\": \"<string>\",\n \"remainingBudget\": 123\n }\n ],\n \"annotations\": {}\n }\n ],\n \"groups\": [\n [\n \"<string>\"\n ]\n ],\n \"customTools\": {}\n },\n \"namespaceProvider\": {\n \"type\": \"create_if_not_exists\",\n \"namespaceRequest\": {\n \"name\": \"<string>\",\n \"deleteOnLastSessionExit\": true,\n \"annotations\": {}\n }\n },\n \"execution\": {\n \"mode\": \"defer\"\n },\n \"annotations\": {}\n}"
response = http.request(request)
puts response.read_body{
"namespace": "<string>",
"sessionId": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
The session request body, containing the agents to use in the session and other settings
A request for the agents in this session
Show child attributes
Show child attributes
Provides a full namespace request to create an ad hoc namespace if the namespace doesn't already exist. Note
that this will not update an existing namespace, so for example, there is no guarantee that annotations
specified on this request end up on the namespace that this session belongs in.- create_if_not_exists
- use_existing
Show child attributes
Show child attributes
The session's execution is deferred. A deferred execution must be executed manually later
- defer
- immediate
Show child attributes
Show child attributes
Show child attributes
Show child attributes
⌘I
Create session
curl --request POST \
--url https://api.example.com/api/v1/local/session \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agentGraphRequest": {
"agents": [
{
"id": {
"name": "<string>",
"version": "<string>",
"registrySourceId": {
"type": "linked",
"linkedServerId": "<string>"
}
},
"name": "<string>",
"provider": {
"type": "linked",
"linkedServerName": "<string>"
},
"proxies": {},
"description": "<string>",
"options": {},
"systemPrompt": "<string>",
"blocking": true,
"customToolAccess": [
"<string>"
],
"plugins": [
{
"type": "close_session_tool"
}
],
"x402Budgets": [
{
"priority": 123,
"resource": "<string>",
"remainingBudget": 123
}
],
"annotations": {}
}
],
"groups": [
[
"<string>"
]
],
"customTools": {}
},
"namespaceProvider": {
"type": "create_if_not_exists",
"namespaceRequest": {
"name": "<string>",
"deleteOnLastSessionExit": true,
"annotations": {}
}
},
"execution": {
"mode": "defer"
},
"annotations": {}
}
'import requests
url = "https://api.example.com/api/v1/local/session"
payload = {
"agentGraphRequest": {
"agents": [
{
"id": {
"name": "<string>",
"version": "<string>",
"registrySourceId": {
"type": "linked",
"linkedServerId": "<string>"
}
},
"name": "<string>",
"provider": {
"type": "linked",
"linkedServerName": "<string>"
},
"proxies": {},
"description": "<string>",
"options": {},
"systemPrompt": "<string>",
"blocking": True,
"customToolAccess": ["<string>"],
"plugins": [{ "type": "close_session_tool" }],
"x402Budgets": [
{
"priority": 123,
"resource": "<string>",
"remainingBudget": 123
}
],
"annotations": {}
}
],
"groups": [["<string>"]],
"customTools": {}
},
"namespaceProvider": {
"type": "create_if_not_exists",
"namespaceRequest": {
"name": "<string>",
"deleteOnLastSessionExit": True,
"annotations": {}
}
},
"execution": { "mode": "defer" },
"annotations": {}
}
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({
agentGraphRequest: {
agents: [
{
id: {
name: '<string>',
version: '<string>',
registrySourceId: {type: 'linked', linkedServerId: '<string>'}
},
name: '<string>',
provider: {type: 'linked', linkedServerName: '<string>'},
proxies: {},
description: '<string>',
options: {},
systemPrompt: '<string>',
blocking: true,
customToolAccess: ['<string>'],
plugins: [{type: 'close_session_tool'}],
x402Budgets: [{priority: 123, resource: '<string>', remainingBudget: 123}],
annotations: {}
}
],
groups: [['<string>']],
customTools: {}
},
namespaceProvider: {
type: 'create_if_not_exists',
namespaceRequest: {name: '<string>', deleteOnLastSessionExit: true, annotations: {}}
},
execution: {mode: 'defer'},
annotations: {}
})
};
fetch('https://api.example.com/api/v1/local/session', 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/api/v1/local/session",
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([
'agentGraphRequest' => [
'agents' => [
[
'id' => [
'name' => '<string>',
'version' => '<string>',
'registrySourceId' => [
'type' => 'linked',
'linkedServerId' => '<string>'
]
],
'name' => '<string>',
'provider' => [
'type' => 'linked',
'linkedServerName' => '<string>'
],
'proxies' => [
],
'description' => '<string>',
'options' => [
],
'systemPrompt' => '<string>',
'blocking' => true,
'customToolAccess' => [
'<string>'
],
'plugins' => [
[
'type' => 'close_session_tool'
]
],
'x402Budgets' => [
[
'priority' => 123,
'resource' => '<string>',
'remainingBudget' => 123
]
],
'annotations' => [
]
]
],
'groups' => [
[
'<string>'
]
],
'customTools' => [
]
],
'namespaceProvider' => [
'type' => 'create_if_not_exists',
'namespaceRequest' => [
'name' => '<string>',
'deleteOnLastSessionExit' => true,
'annotations' => [
]
]
],
'execution' => [
'mode' => 'defer'
],
'annotations' => [
]
]),
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.example.com/api/v1/local/session"
payload := strings.NewReader("{\n \"agentGraphRequest\": {\n \"agents\": [\n {\n \"id\": {\n \"name\": \"<string>\",\n \"version\": \"<string>\",\n \"registrySourceId\": {\n \"type\": \"linked\",\n \"linkedServerId\": \"<string>\"\n }\n },\n \"name\": \"<string>\",\n \"provider\": {\n \"type\": \"linked\",\n \"linkedServerName\": \"<string>\"\n },\n \"proxies\": {},\n \"description\": \"<string>\",\n \"options\": {},\n \"systemPrompt\": \"<string>\",\n \"blocking\": true,\n \"customToolAccess\": [\n \"<string>\"\n ],\n \"plugins\": [\n {\n \"type\": \"close_session_tool\"\n }\n ],\n \"x402Budgets\": [\n {\n \"priority\": 123,\n \"resource\": \"<string>\",\n \"remainingBudget\": 123\n }\n ],\n \"annotations\": {}\n }\n ],\n \"groups\": [\n [\n \"<string>\"\n ]\n ],\n \"customTools\": {}\n },\n \"namespaceProvider\": {\n \"type\": \"create_if_not_exists\",\n \"namespaceRequest\": {\n \"name\": \"<string>\",\n \"deleteOnLastSessionExit\": true,\n \"annotations\": {}\n }\n },\n \"execution\": {\n \"mode\": \"defer\"\n },\n \"annotations\": {}\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.example.com/api/v1/local/session")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agentGraphRequest\": {\n \"agents\": [\n {\n \"id\": {\n \"name\": \"<string>\",\n \"version\": \"<string>\",\n \"registrySourceId\": {\n \"type\": \"linked\",\n \"linkedServerId\": \"<string>\"\n }\n },\n \"name\": \"<string>\",\n \"provider\": {\n \"type\": \"linked\",\n \"linkedServerName\": \"<string>\"\n },\n \"proxies\": {},\n \"description\": \"<string>\",\n \"options\": {},\n \"systemPrompt\": \"<string>\",\n \"blocking\": true,\n \"customToolAccess\": [\n \"<string>\"\n ],\n \"plugins\": [\n {\n \"type\": \"close_session_tool\"\n }\n ],\n \"x402Budgets\": [\n {\n \"priority\": 123,\n \"resource\": \"<string>\",\n \"remainingBudget\": 123\n }\n ],\n \"annotations\": {}\n }\n ],\n \"groups\": [\n [\n \"<string>\"\n ]\n ],\n \"customTools\": {}\n },\n \"namespaceProvider\": {\n \"type\": \"create_if_not_exists\",\n \"namespaceRequest\": {\n \"name\": \"<string>\",\n \"deleteOnLastSessionExit\": true,\n \"annotations\": {}\n }\n },\n \"execution\": {\n \"mode\": \"defer\"\n },\n \"annotations\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/local/session")
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 \"agentGraphRequest\": {\n \"agents\": [\n {\n \"id\": {\n \"name\": \"<string>\",\n \"version\": \"<string>\",\n \"registrySourceId\": {\n \"type\": \"linked\",\n \"linkedServerId\": \"<string>\"\n }\n },\n \"name\": \"<string>\",\n \"provider\": {\n \"type\": \"linked\",\n \"linkedServerName\": \"<string>\"\n },\n \"proxies\": {},\n \"description\": \"<string>\",\n \"options\": {},\n \"systemPrompt\": \"<string>\",\n \"blocking\": true,\n \"customToolAccess\": [\n \"<string>\"\n ],\n \"plugins\": [\n {\n \"type\": \"close_session_tool\"\n }\n ],\n \"x402Budgets\": [\n {\n \"priority\": 123,\n \"resource\": \"<string>\",\n \"remainingBudget\": 123\n }\n ],\n \"annotations\": {}\n }\n ],\n \"groups\": [\n [\n \"<string>\"\n ]\n ],\n \"customTools\": {}\n },\n \"namespaceProvider\": {\n \"type\": \"create_if_not_exists\",\n \"namespaceRequest\": {\n \"name\": \"<string>\",\n \"deleteOnLastSessionExit\": true,\n \"annotations\": {}\n }\n },\n \"execution\": {\n \"mode\": \"defer\"\n },\n \"annotations\": {}\n}"
response = http.request(request)
puts response.read_body{
"namespace": "<string>",
"sessionId": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}