v1
Create Task For Agent With Stream
Create and execute a task for the specified agent with real-time SSE stream.
POST
/
v1
/
agents
/
{agent_id}
/
tasks
/
Create Task For Agent With Stream
curl --request POST \
--url https://api.example.com/v1/agents/{agent_id}/tasks/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "<string>",
"attachments": [
"<string>"
],
"execution": {
"max_model_turns": 123
},
"parameters": {},
"project_id": "<string>",
"requires_human_approval": false,
"task_policy": {
"approval": {
"approvers": [
"<string>"
],
"approvers_by_tool": {},
"escalation_rules": [
"<string>"
],
"requires_human_approval": true
},
"budget": {
"monthly_spend_cap_usd": 123,
"run_budget_usd": 123,
"service_budget_usd": 123
},
"content_safety": {
"output_sanitizer_enabled": true,
"prompt_injection_detection_enabled": true
},
"execution": {
"max_model_turns": 1,
"max_tool_calls_per_turn": 1,
"max_tool_calls_total": 1
},
"tokens": {
"max_tokens": 1,
"max_tokens_per_call": 1
},
"tools": {
"allowed": [
"<string>"
],
"denied": [
"<string>"
]
}
}
}
'import requests
url = "https://api.example.com/v1/agents/{agent_id}/tasks/"
payload = {
"description": "<string>",
"attachments": ["<string>"],
"execution": { "max_model_turns": 123 },
"parameters": {},
"project_id": "<string>",
"requires_human_approval": False,
"task_policy": {
"approval": {
"approvers": ["<string>"],
"approvers_by_tool": {},
"escalation_rules": ["<string>"],
"requires_human_approval": True
},
"budget": {
"monthly_spend_cap_usd": 123,
"run_budget_usd": 123,
"service_budget_usd": 123
},
"content_safety": {
"output_sanitizer_enabled": True,
"prompt_injection_detection_enabled": True
},
"execution": {
"max_model_turns": 1,
"max_tool_calls_per_turn": 1,
"max_tool_calls_total": 1
},
"tokens": {
"max_tokens": 1,
"max_tokens_per_call": 1
},
"tools": {
"allowed": ["<string>"],
"denied": ["<string>"]
}
}
}
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({
description: '<string>',
attachments: ['<string>'],
execution: {max_model_turns: 123},
parameters: {},
project_id: '<string>',
requires_human_approval: false,
task_policy: {
approval: {
approvers: ['<string>'],
approvers_by_tool: {},
escalation_rules: ['<string>'],
requires_human_approval: true
},
budget: {monthly_spend_cap_usd: 123, run_budget_usd: 123, service_budget_usd: 123},
content_safety: {output_sanitizer_enabled: true, prompt_injection_detection_enabled: true},
execution: {max_model_turns: 1, max_tool_calls_per_turn: 1, max_tool_calls_total: 1},
tokens: {max_tokens: 1, max_tokens_per_call: 1},
tools: {allowed: ['<string>'], denied: ['<string>']}
}
})
};
fetch('https://api.example.com/v1/agents/{agent_id}/tasks/', 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/agents/{agent_id}/tasks/",
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([
'description' => '<string>',
'attachments' => [
'<string>'
],
'execution' => [
'max_model_turns' => 123
],
'parameters' => [
],
'project_id' => '<string>',
'requires_human_approval' => false,
'task_policy' => [
'approval' => [
'approvers' => [
'<string>'
],
'approvers_by_tool' => [
],
'escalation_rules' => [
'<string>'
],
'requires_human_approval' => true
],
'budget' => [
'monthly_spend_cap_usd' => 123,
'run_budget_usd' => 123,
'service_budget_usd' => 123
],
'content_safety' => [
'output_sanitizer_enabled' => true,
'prompt_injection_detection_enabled' => true
],
'execution' => [
'max_model_turns' => 1,
'max_tool_calls_per_turn' => 1,
'max_tool_calls_total' => 1
],
'tokens' => [
'max_tokens' => 1,
'max_tokens_per_call' => 1
],
'tools' => [
'allowed' => [
'<string>'
],
'denied' => [
'<string>'
]
]
]
]),
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/v1/agents/{agent_id}/tasks/"
payload := strings.NewReader("{\n \"description\": \"<string>\",\n \"attachments\": [\n \"<string>\"\n ],\n \"execution\": {\n \"max_model_turns\": 123\n },\n \"parameters\": {},\n \"project_id\": \"<string>\",\n \"requires_human_approval\": false,\n \"task_policy\": {\n \"approval\": {\n \"approvers\": [\n \"<string>\"\n ],\n \"approvers_by_tool\": {},\n \"escalation_rules\": [\n \"<string>\"\n ],\n \"requires_human_approval\": true\n },\n \"budget\": {\n \"monthly_spend_cap_usd\": 123,\n \"run_budget_usd\": 123,\n \"service_budget_usd\": 123\n },\n \"content_safety\": {\n \"output_sanitizer_enabled\": true,\n \"prompt_injection_detection_enabled\": true\n },\n \"execution\": {\n \"max_model_turns\": 1,\n \"max_tool_calls_per_turn\": 1,\n \"max_tool_calls_total\": 1\n },\n \"tokens\": {\n \"max_tokens\": 1,\n \"max_tokens_per_call\": 1\n },\n \"tools\": {\n \"allowed\": [\n \"<string>\"\n ],\n \"denied\": [\n \"<string>\"\n ]\n }\n }\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/v1/agents/{agent_id}/tasks/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"<string>\",\n \"attachments\": [\n \"<string>\"\n ],\n \"execution\": {\n \"max_model_turns\": 123\n },\n \"parameters\": {},\n \"project_id\": \"<string>\",\n \"requires_human_approval\": false,\n \"task_policy\": {\n \"approval\": {\n \"approvers\": [\n \"<string>\"\n ],\n \"approvers_by_tool\": {},\n \"escalation_rules\": [\n \"<string>\"\n ],\n \"requires_human_approval\": true\n },\n \"budget\": {\n \"monthly_spend_cap_usd\": 123,\n \"run_budget_usd\": 123,\n \"service_budget_usd\": 123\n },\n \"content_safety\": {\n \"output_sanitizer_enabled\": true,\n \"prompt_injection_detection_enabled\": true\n },\n \"execution\": {\n \"max_model_turns\": 1,\n \"max_tool_calls_per_turn\": 1,\n \"max_tool_calls_total\": 1\n },\n \"tokens\": {\n \"max_tokens\": 1,\n \"max_tokens_per_call\": 1\n },\n \"tools\": {\n \"allowed\": [\n \"<string>\"\n ],\n \"denied\": [\n \"<string>\"\n ]\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/agents/{agent_id}/tasks/")
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 \"description\": \"<string>\",\n \"attachments\": [\n \"<string>\"\n ],\n \"execution\": {\n \"max_model_turns\": 123\n },\n \"parameters\": {},\n \"project_id\": \"<string>\",\n \"requires_human_approval\": false,\n \"task_policy\": {\n \"approval\": {\n \"approvers\": [\n \"<string>\"\n ],\n \"approvers_by_tool\": {},\n \"escalation_rules\": [\n \"<string>\"\n ],\n \"requires_human_approval\": true\n },\n \"budget\": {\n \"monthly_spend_cap_usd\": 123,\n \"run_budget_usd\": 123,\n \"service_budget_usd\": 123\n },\n \"content_safety\": {\n \"output_sanitizer_enabled\": true,\n \"prompt_injection_detection_enabled\": true\n },\n \"execution\": {\n \"max_model_turns\": 1,\n \"max_tool_calls_per_turn\": 1,\n \"max_tool_calls_total\": 1\n },\n \"tokens\": {\n \"max_tokens\": 1,\n \"max_tokens_per_call\": 1\n },\n \"tools\": {\n \"allowed\": [\n \"<string>\"\n ],\n \"denied\": [\n \"<string>\"\n ]\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"ctx": {},
"input": "<unknown>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
application/json
Caller-requested execution ceiling; governance may only tighten it.
Show child attributes
Show child attributes
Source policy document stored per scope.
Show child attributes
Show child attributes
Response
Successful Response
⌘I
Create Task For Agent With Stream
curl --request POST \
--url https://api.example.com/v1/agents/{agent_id}/tasks/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "<string>",
"attachments": [
"<string>"
],
"execution": {
"max_model_turns": 123
},
"parameters": {},
"project_id": "<string>",
"requires_human_approval": false,
"task_policy": {
"approval": {
"approvers": [
"<string>"
],
"approvers_by_tool": {},
"escalation_rules": [
"<string>"
],
"requires_human_approval": true
},
"budget": {
"monthly_spend_cap_usd": 123,
"run_budget_usd": 123,
"service_budget_usd": 123
},
"content_safety": {
"output_sanitizer_enabled": true,
"prompt_injection_detection_enabled": true
},
"execution": {
"max_model_turns": 1,
"max_tool_calls_per_turn": 1,
"max_tool_calls_total": 1
},
"tokens": {
"max_tokens": 1,
"max_tokens_per_call": 1
},
"tools": {
"allowed": [
"<string>"
],
"denied": [
"<string>"
]
}
}
}
'import requests
url = "https://api.example.com/v1/agents/{agent_id}/tasks/"
payload = {
"description": "<string>",
"attachments": ["<string>"],
"execution": { "max_model_turns": 123 },
"parameters": {},
"project_id": "<string>",
"requires_human_approval": False,
"task_policy": {
"approval": {
"approvers": ["<string>"],
"approvers_by_tool": {},
"escalation_rules": ["<string>"],
"requires_human_approval": True
},
"budget": {
"monthly_spend_cap_usd": 123,
"run_budget_usd": 123,
"service_budget_usd": 123
},
"content_safety": {
"output_sanitizer_enabled": True,
"prompt_injection_detection_enabled": True
},
"execution": {
"max_model_turns": 1,
"max_tool_calls_per_turn": 1,
"max_tool_calls_total": 1
},
"tokens": {
"max_tokens": 1,
"max_tokens_per_call": 1
},
"tools": {
"allowed": ["<string>"],
"denied": ["<string>"]
}
}
}
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({
description: '<string>',
attachments: ['<string>'],
execution: {max_model_turns: 123},
parameters: {},
project_id: '<string>',
requires_human_approval: false,
task_policy: {
approval: {
approvers: ['<string>'],
approvers_by_tool: {},
escalation_rules: ['<string>'],
requires_human_approval: true
},
budget: {monthly_spend_cap_usd: 123, run_budget_usd: 123, service_budget_usd: 123},
content_safety: {output_sanitizer_enabled: true, prompt_injection_detection_enabled: true},
execution: {max_model_turns: 1, max_tool_calls_per_turn: 1, max_tool_calls_total: 1},
tokens: {max_tokens: 1, max_tokens_per_call: 1},
tools: {allowed: ['<string>'], denied: ['<string>']}
}
})
};
fetch('https://api.example.com/v1/agents/{agent_id}/tasks/', 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/agents/{agent_id}/tasks/",
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([
'description' => '<string>',
'attachments' => [
'<string>'
],
'execution' => [
'max_model_turns' => 123
],
'parameters' => [
],
'project_id' => '<string>',
'requires_human_approval' => false,
'task_policy' => [
'approval' => [
'approvers' => [
'<string>'
],
'approvers_by_tool' => [
],
'escalation_rules' => [
'<string>'
],
'requires_human_approval' => true
],
'budget' => [
'monthly_spend_cap_usd' => 123,
'run_budget_usd' => 123,
'service_budget_usd' => 123
],
'content_safety' => [
'output_sanitizer_enabled' => true,
'prompt_injection_detection_enabled' => true
],
'execution' => [
'max_model_turns' => 1,
'max_tool_calls_per_turn' => 1,
'max_tool_calls_total' => 1
],
'tokens' => [
'max_tokens' => 1,
'max_tokens_per_call' => 1
],
'tools' => [
'allowed' => [
'<string>'
],
'denied' => [
'<string>'
]
]
]
]),
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/v1/agents/{agent_id}/tasks/"
payload := strings.NewReader("{\n \"description\": \"<string>\",\n \"attachments\": [\n \"<string>\"\n ],\n \"execution\": {\n \"max_model_turns\": 123\n },\n \"parameters\": {},\n \"project_id\": \"<string>\",\n \"requires_human_approval\": false,\n \"task_policy\": {\n \"approval\": {\n \"approvers\": [\n \"<string>\"\n ],\n \"approvers_by_tool\": {},\n \"escalation_rules\": [\n \"<string>\"\n ],\n \"requires_human_approval\": true\n },\n \"budget\": {\n \"monthly_spend_cap_usd\": 123,\n \"run_budget_usd\": 123,\n \"service_budget_usd\": 123\n },\n \"content_safety\": {\n \"output_sanitizer_enabled\": true,\n \"prompt_injection_detection_enabled\": true\n },\n \"execution\": {\n \"max_model_turns\": 1,\n \"max_tool_calls_per_turn\": 1,\n \"max_tool_calls_total\": 1\n },\n \"tokens\": {\n \"max_tokens\": 1,\n \"max_tokens_per_call\": 1\n },\n \"tools\": {\n \"allowed\": [\n \"<string>\"\n ],\n \"denied\": [\n \"<string>\"\n ]\n }\n }\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/v1/agents/{agent_id}/tasks/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"<string>\",\n \"attachments\": [\n \"<string>\"\n ],\n \"execution\": {\n \"max_model_turns\": 123\n },\n \"parameters\": {},\n \"project_id\": \"<string>\",\n \"requires_human_approval\": false,\n \"task_policy\": {\n \"approval\": {\n \"approvers\": [\n \"<string>\"\n ],\n \"approvers_by_tool\": {},\n \"escalation_rules\": [\n \"<string>\"\n ],\n \"requires_human_approval\": true\n },\n \"budget\": {\n \"monthly_spend_cap_usd\": 123,\n \"run_budget_usd\": 123,\n \"service_budget_usd\": 123\n },\n \"content_safety\": {\n \"output_sanitizer_enabled\": true,\n \"prompt_injection_detection_enabled\": true\n },\n \"execution\": {\n \"max_model_turns\": 1,\n \"max_tool_calls_per_turn\": 1,\n \"max_tool_calls_total\": 1\n },\n \"tokens\": {\n \"max_tokens\": 1,\n \"max_tokens_per_call\": 1\n },\n \"tools\": {\n \"allowed\": [\n \"<string>\"\n ],\n \"denied\": [\n \"<string>\"\n ]\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/agents/{agent_id}/tasks/")
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 \"description\": \"<string>\",\n \"attachments\": [\n \"<string>\"\n ],\n \"execution\": {\n \"max_model_turns\": 123\n },\n \"parameters\": {},\n \"project_id\": \"<string>\",\n \"requires_human_approval\": false,\n \"task_policy\": {\n \"approval\": {\n \"approvers\": [\n \"<string>\"\n ],\n \"approvers_by_tool\": {},\n \"escalation_rules\": [\n \"<string>\"\n ],\n \"requires_human_approval\": true\n },\n \"budget\": {\n \"monthly_spend_cap_usd\": 123,\n \"run_budget_usd\": 123,\n \"service_budget_usd\": 123\n },\n \"content_safety\": {\n \"output_sanitizer_enabled\": true,\n \"prompt_injection_detection_enabled\": true\n },\n \"execution\": {\n \"max_model_turns\": 1,\n \"max_tool_calls_per_turn\": 1,\n \"max_tool_calls_total\": 1\n },\n \"tokens\": {\n \"max_tokens\": 1,\n \"max_tokens_per_call\": 1\n },\n \"tools\": {\n \"allowed\": [\n \"<string>\"\n ],\n \"denied\": [\n \"<string>\"\n ]\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"ctx": {},
"input": "<unknown>"
}
]
}