Skip to main content
POST
/
agent
/
Create a new agent
curl --request POST \
  --url https://api.example.com/agent/ \
  --header 'Content-Type: application/json' \
  --header 'x-user-id: <x-user-id>' \
  --data @- <<EOF
{
  "name": "<string>",
  "system_prompt": "You're a helpful assistant.",
  "context_config": {
    "trigger_ratio": 0.8,
    "reserve_ratio": 0.1,
    "compression_prompt": "<system-hint>You have been working on the task described above but have not yet completed it. Now write a continuation summary that will allow you to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable.</system-hint>",
    "summary_template": "<system-info>Here is a summary of your previous work\n# Task Overview\n{task_overview}\n\n# Current State\n{current_state}\n\n# Important Discoveries\n{important_discoveries}\n\n# Next Steps\n{next_steps}\n\n# Context to Preserve\n{context_to_preserve}</system-info>",
    "summary_schema": {},
    "tool_result_limit": 3000
  },
  "react_config": {
    "max_iters": 20,
    "stop_on_reject": false
  }
}
EOF
import requests

url = "https://api.example.com/agent/"

payload = {
"name": "<string>",
"system_prompt": "You're a helpful assistant.",
"context_config": {
"trigger_ratio": 0.8,
"reserve_ratio": 0.1,
"compression_prompt": "<system-hint>You have been working on the task described above but have not yet completed it. Now write a continuation summary that will allow you to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable.</system-hint>",
"summary_template": "<system-info>Here is a summary of your previous work
# Task Overview
{task_overview}

# Current State
{current_state}

# Important Discoveries
{important_discoveries}

# Next Steps
{next_steps}

# Context to Preserve
{context_to_preserve}</system-info>",
"summary_schema": {},
"tool_result_limit": 3000
},
"react_config": {
"max_iters": 20,
"stop_on_reject": False
}
}
headers = {
"x-user-id": "<x-user-id>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'x-user-id': '<x-user-id>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
system_prompt: 'You\'re a helpful assistant.',
context_config: {
trigger_ratio: 0.8,
reserve_ratio: 0.1,
compression_prompt: '<system-hint>You have been working on the task described above but have not yet completed it. Now write a continuation summary that will allow you to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable.</system-hint>',
summary_template: '<system-info>Here is a summary of your previous work\n# Task Overview\n{task_overview}\n\n# Current State\n{current_state}\n\n# Important Discoveries\n{important_discoveries}\n\n# Next Steps\n{next_steps}\n\n# Context to Preserve\n{context_to_preserve}</system-info>',
summary_schema: {},
tool_result_limit: 3000
},
react_config: {max_iters: 20, stop_on_reject: false}
})
};

fetch('https://api.example.com/agent/', 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/agent/",
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([
'name' => '<string>',
'system_prompt' => 'You\'re a helpful assistant.',
'context_config' => [
'trigger_ratio' => 0.8,
'reserve_ratio' => 0.1,
'compression_prompt' => '<system-hint>You have been working on the task described above but have not yet completed it. Now write a continuation summary that will allow you to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable.</system-hint>',
'summary_template' => '<system-info>Here is a summary of your previous work
# Task Overview
{task_overview}

# Current State
{current_state}

# Important Discoveries
{important_discoveries}

# Next Steps
{next_steps}

# Context to Preserve
{context_to_preserve}</system-info>',
'summary_schema' => [

],
'tool_result_limit' => 3000
],
'react_config' => [
'max_iters' => 20,
'stop_on_reject' => false
]
]),
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/agent/"

payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"system_prompt\": \"You're a helpful assistant.\",\n \"context_config\": {\n \"trigger_ratio\": 0.8,\n \"reserve_ratio\": 0.1,\n \"compression_prompt\": \"<system-hint>You have been working on the task described above but have not yet completed it. Now write a continuation summary that will allow you to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable.</system-hint>\",\n \"summary_template\": \"<system-info>Here is a summary of your previous work\\n# Task Overview\\n{task_overview}\\n\\n# Current State\\n{current_state}\\n\\n# Important Discoveries\\n{important_discoveries}\\n\\n# Next Steps\\n{next_steps}\\n\\n# Context to Preserve\\n{context_to_preserve}</system-info>\",\n \"summary_schema\": {},\n \"tool_result_limit\": 3000\n },\n \"react_config\": {\n \"max_iters\": 20,\n \"stop_on_reject\": false\n }\n}")

req, _ := http.NewRequest("POST", 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.post("https://api.example.com/agent/")
.header("x-user-id", "<x-user-id>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"system_prompt\": \"You're a helpful assistant.\",\n \"context_config\": {\n \"trigger_ratio\": 0.8,\n \"reserve_ratio\": 0.1,\n \"compression_prompt\": \"<system-hint>You have been working on the task described above but have not yet completed it. Now write a continuation summary that will allow you to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable.</system-hint>\",\n \"summary_template\": \"<system-info>Here is a summary of your previous work\\n# Task Overview\\n{task_overview}\\n\\n# Current State\\n{current_state}\\n\\n# Important Discoveries\\n{important_discoveries}\\n\\n# Next Steps\\n{next_steps}\\n\\n# Context to Preserve\\n{context_to_preserve}</system-info>\",\n \"summary_schema\": {},\n \"tool_result_limit\": 3000\n },\n \"react_config\": {\n \"max_iters\": 20,\n \"stop_on_reject\": false\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/agent/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-user-id"] = '<x-user-id>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"system_prompt\": \"You're a helpful assistant.\",\n \"context_config\": {\n \"trigger_ratio\": 0.8,\n \"reserve_ratio\": 0.1,\n \"compression_prompt\": \"<system-hint>You have been working on the task described above but have not yet completed it. Now write a continuation summary that will allow you to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable.</system-hint>\",\n \"summary_template\": \"<system-info>Here is a summary of your previous work\\n# Task Overview\\n{task_overview}\\n\\n# Current State\\n{current_state}\\n\\n# Important Discoveries\\n{important_discoveries}\\n\\n# Next Steps\\n{next_steps}\\n\\n# Context to Preserve\\n{context_to_preserve}</system-info>\",\n \"summary_schema\": {},\n \"tool_result_limit\": 3000\n },\n \"react_config\": {\n \"max_iters\": 20,\n \"stop_on_reject\": false\n }\n}"

response = http.request(request)
puts response.read_body
{
  "agent_id": "<string>"
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}

Headers

x-user-id
string
required

Caller's user ID. Temporary header-based identity; will be replaced by JWT auth.

Body

application/json

Request body for creating a new agent.

name
string
required

Display name of the agent.

system_prompt
string
default:You're a helpful assistant.

Base system prompt fed to the agent.

context_config
ContextConfig · object

Context-window management configuration.

react_config
ReActConfig · object

ReAct loop configuration.

Response

Successful Response

Response body after creating an agent.

agent_id
string
required

Server-assigned agent identifier.