Skip to main content
POST
/
agents
/
{agent_id}
/
chat
Chat With Agent
curl --request POST \
  --url https://api.example.com/agents/{agent_id}/chat \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "query": "<string>",
  "conversation_id": "<string>",
  "context_overrides": {},
  "top_k": 5
}
'
import requests

url = "https://api.example.com/agents/{agent_id}/chat"

payload = {
"query": "<string>",
"conversation_id": "<string>",
"context_overrides": {},
"top_k": 5
}
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({
query: '<string>',
conversation_id: '<string>',
context_overrides: {},
top_k: 5
})
};

fetch('https://api.example.com/agents/{agent_id}/chat', 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/agents/{agent_id}/chat",
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([
'query' => '<string>',
'conversation_id' => '<string>',
'context_overrides' => [

],
'top_k' => 5
]),
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/agents/{agent_id}/chat"

payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"conversation_id\": \"<string>\",\n \"context_overrides\": {},\n \"top_k\": 5\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/agents/{agent_id}/chat")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"conversation_id\": \"<string>\",\n \"context_overrides\": {},\n \"top_k\": 5\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/agents/{agent_id}/chat")

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 \"query\": \"<string>\",\n \"conversation_id\": \"<string>\",\n \"context_overrides\": {},\n \"top_k\": 5\n}"

response = http.request(request)
puts response.read_body
{
  "response": "<string>",
  "conversation_id": "<string>",
  "trace_id": "<string>",
  "execution_time_ms": 123,
  "versions": {},
  "payload": {},
  "selected_tool": "<string>",
  "outcome_label": "<string>"
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

agent_id
string<uuid>
required

Body

application/json

Request to chat with an agent via text.

query
string
required

User's message/query

Required string length: 1 - 2000
conversation_id
string | null

Existing conversation ID to continue

context_overrides
Context Overrides · object | null

Additional context for this query

top_k
integer
default:5

Number of knowledge chunks to retrieve

Required range: 1 <= x <= 20

Response

Successful Response

Response from agent chat.

response
string
required

Agent's text response

conversation_id
string
required

Conversation ID for follow-up messages

trace_id
string
required

Trace ID for debugging

execution_time_ms
integer
required

Execution time in milliseconds

versions
Versions · object
required

Version information (kb, policy, tools)

payload
Payload · object | null

Tool output payload if applicable

selected_tool
string | null

Tool that was executed

outcome_label
string | null

Outcome classification