Query agent runs
curl --request POST \
--url https://api.example.com/api/v1/business/agent-runs/query \
--header 'Content-Type: application/json' \
--header 'x-project-id: <x-project-id>' \
--data '
{
"task_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"cursor": "<string>",
"limit": 50
}
'import requests
url = "https://api.example.com/api/v1/business/agent-runs/query"
payload = {
"task_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"cursor": "<string>",
"limit": 50
}
headers = {
"x-project-id": "<x-project-id>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-project-id': '<x-project-id>', 'Content-Type': 'application/json'},
body: JSON.stringify({
task_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
agent_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
run_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
cursor: '<string>',
limit: 50
})
};
fetch('https://api.example.com/api/v1/business/agent-runs/query', 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/business/agent-runs/query",
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([
'task_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'agent_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'run_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'cursor' => '<string>',
'limit' => 50
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-project-id: <x-project-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/api/v1/business/agent-runs/query"
payload := strings.NewReader("{\n \"task_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"run_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"cursor\": \"<string>\",\n \"limit\": 50\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-project-id", "<x-project-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/api/v1/business/agent-runs/query")
.header("x-project-id", "<x-project-id>")
.header("Content-Type", "application/json")
.body("{\n \"task_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"run_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"cursor\": \"<string>\",\n \"limit\": 50\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/business/agent-runs/query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-project-id"] = '<x-project-id>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"task_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"run_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"cursor\": \"<string>\",\n \"limit\": 50\n}"
response = http.request(request)
puts response.read_body{
"items": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"task_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending",
"trigger": "task_assigned",
"started_at": "2023-11-07T05:31:56Z",
"ended_at": "2023-11-07T05:31:56Z",
"error_message": "<string>",
"failure_reason": "iteration_limit",
"log_pointer": "<string>",
"last_comment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"cancelled_by_user_id": "<string>",
"input_tokens": 123,
"output_tokens": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"next_cursor": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Agent Runs
Query agent runs
Get agent run history for a task or an agent, or step-by-step progress for one run. Scope task_runs needs task_id, agent_runs needs agent_id, run_progress needs task_id and run_id.
POST
/
api
/
v1
/
business
/
agent-runs
/
query
Query agent runs
curl --request POST \
--url https://api.example.com/api/v1/business/agent-runs/query \
--header 'Content-Type: application/json' \
--header 'x-project-id: <x-project-id>' \
--data '
{
"task_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"cursor": "<string>",
"limit": 50
}
'import requests
url = "https://api.example.com/api/v1/business/agent-runs/query"
payload = {
"task_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"cursor": "<string>",
"limit": 50
}
headers = {
"x-project-id": "<x-project-id>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-project-id': '<x-project-id>', 'Content-Type': 'application/json'},
body: JSON.stringify({
task_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
agent_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
run_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
cursor: '<string>',
limit: 50
})
};
fetch('https://api.example.com/api/v1/business/agent-runs/query', 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/business/agent-runs/query",
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([
'task_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'agent_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'run_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'cursor' => '<string>',
'limit' => 50
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-project-id: <x-project-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/api/v1/business/agent-runs/query"
payload := strings.NewReader("{\n \"task_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"run_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"cursor\": \"<string>\",\n \"limit\": 50\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-project-id", "<x-project-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/api/v1/business/agent-runs/query")
.header("x-project-id", "<x-project-id>")
.header("Content-Type", "application/json")
.body("{\n \"task_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"run_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"cursor\": \"<string>\",\n \"limit\": 50\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/business/agent-runs/query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-project-id"] = '<x-project-id>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"task_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"run_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"cursor\": \"<string>\",\n \"limit\": 50\n}"
response = http.request(request)
puts response.read_body{
"items": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"task_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending",
"trigger": "task_assigned",
"started_at": "2023-11-07T05:31:56Z",
"ended_at": "2023-11-07T05:31:56Z",
"error_message": "<string>",
"failure_reason": "iteration_limit",
"log_pointer": "<string>",
"last_comment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"cancelled_by_user_id": "<string>",
"input_tokens": 123,
"output_tokens": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"next_cursor": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Headers
Project ID for tenant scoping
Overrides the key's workspace
User API key
Body
application/json
Which run view: task_runs, agent_runs, or run_progress
Available options:
task_runs, agent_runs, run_progress Task id; required for task_runs and run_progress
Agent id; required for agent_runs
Run id; required for run_progress
Pagination cursor for the run list scopes
Page size for the run list scopes
Required range:
1 <= x <= 100Was this page helpful?
⌘I