Start a run and wait
curl --request POST \
--url https://api.xpertai.cn/api/ai/threads/{thread_id}/runs/wait \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"assistant_id": "22222222-2222-4222-8222-222222222222",
"input": {
"action": "send",
"message": {
"input": {
"input": "Hello, introduce yourself briefly."
}
}
}
}
'import requests
url = "https://api.xpertai.cn/api/ai/threads/{thread_id}/runs/wait"
payload = {
"assistant_id": "22222222-2222-4222-8222-222222222222",
"input": {
"action": "send",
"message": { "input": { "input": "Hello, introduce yourself briefly." } }
}
}
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({
assistant_id: '22222222-2222-4222-8222-222222222222',
input: {
action: 'send',
message: {input: {input: 'Hello, introduce yourself briefly.'}}
}
})
};
fetch('https://api.xpertai.cn/api/ai/threads/{thread_id}/runs/wait', 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.xpertai.cn/api/ai/threads/{thread_id}/runs/wait",
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([
'assistant_id' => '22222222-2222-4222-8222-222222222222',
'input' => [
'action' => 'send',
'message' => [
'input' => [
'input' => 'Hello, introduce yourself briefly.'
]
]
]
]),
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.xpertai.cn/api/ai/threads/{thread_id}/runs/wait"
payload := strings.NewReader("{\n \"assistant_id\": \"22222222-2222-4222-8222-222222222222\",\n \"input\": {\n \"action\": \"send\",\n \"message\": {\n \"input\": {\n \"input\": \"Hello, introduce yourself briefly.\"\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.xpertai.cn/api/ai/threads/{thread_id}/runs/wait")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"assistant_id\": \"22222222-2222-4222-8222-222222222222\",\n \"input\": {\n \"action\": \"send\",\n \"message\": {\n \"input\": {\n \"input\": \"Hello, introduce yourself briefly.\"\n }\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.xpertai.cn/api/ai/threads/{thread_id}/runs/wait")
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 \"assistant_id\": \"22222222-2222-4222-8222-222222222222\",\n \"input\": {\n \"action\": \"send\",\n \"message\": {\n \"input\": {\n \"input\": \"Hello, introduce yourself briefly.\"\n }\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"role": "ai",
"content": "Hello"
}Runs
Start a run and wait
Start a new run and return accumulated plain text when its stream completes. The current response is {"role":"ai","content":"..."}, not a Run record or a full graph state. This does not wait on an existing run_id. Use streaming for interruption and detailed progress handling.
POST
/
api
/
ai
/
threads
/
{thread_id}
/
runs
/
wait
Start a run and wait
curl --request POST \
--url https://api.xpertai.cn/api/ai/threads/{thread_id}/runs/wait \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"assistant_id": "22222222-2222-4222-8222-222222222222",
"input": {
"action": "send",
"message": {
"input": {
"input": "Hello, introduce yourself briefly."
}
}
}
}
'import requests
url = "https://api.xpertai.cn/api/ai/threads/{thread_id}/runs/wait"
payload = {
"assistant_id": "22222222-2222-4222-8222-222222222222",
"input": {
"action": "send",
"message": { "input": { "input": "Hello, introduce yourself briefly." } }
}
}
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({
assistant_id: '22222222-2222-4222-8222-222222222222',
input: {
action: 'send',
message: {input: {input: 'Hello, introduce yourself briefly.'}}
}
})
};
fetch('https://api.xpertai.cn/api/ai/threads/{thread_id}/runs/wait', 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.xpertai.cn/api/ai/threads/{thread_id}/runs/wait",
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([
'assistant_id' => '22222222-2222-4222-8222-222222222222',
'input' => [
'action' => 'send',
'message' => [
'input' => [
'input' => 'Hello, introduce yourself briefly.'
]
]
]
]),
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.xpertai.cn/api/ai/threads/{thread_id}/runs/wait"
payload := strings.NewReader("{\n \"assistant_id\": \"22222222-2222-4222-8222-222222222222\",\n \"input\": {\n \"action\": \"send\",\n \"message\": {\n \"input\": {\n \"input\": \"Hello, introduce yourself briefly.\"\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.xpertai.cn/api/ai/threads/{thread_id}/runs/wait")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"assistant_id\": \"22222222-2222-4222-8222-222222222222\",\n \"input\": {\n \"action\": \"send\",\n \"message\": {\n \"input\": {\n \"input\": \"Hello, introduce yourself briefly.\"\n }\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.xpertai.cn/api/ai/threads/{thread_id}/runs/wait")
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 \"assistant_id\": \"22222222-2222-4222-8222-222222222222\",\n \"input\": {\n \"action\": \"send\",\n \"message\": {\n \"input\": {\n \"input\": \"Hello, introduce yourself briefly.\"\n }\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"role": "ai",
"content": "Hello"
}Authorizations
ApiKeyBearerApiKeyHeader
Server-side API Key; do not expose it in browser code.
Path Parameters
Body
application/json
Published agent ID. HTTP uses assistant_id; the SDK accepts assistantId as a method argument.
Chat action payload. Examples show send; retry, resume and follow_up require the appropriate execution state and access.
- Option 1
- Option 2
- Option 3
- Option 4
Show child attributes
Show child attributes
Optional runtime context. Use only fields supported by your deployed agent.