Python
import os
from qaip import Qaip
client = Qaip(
api_key=os.environ.get("QAIP_API_KEY"), # This is the default and can be omitted
)
agent_thread_detail = client.agent.retrieve_thread(
thread_id="thread_id",
)
print(agent_thread_detail.thread_id)curl https://developer.qaip.com/api/v1/agent/threads/$THREAD_ID \
-H "x-api-key: $QAIP_API_KEY"const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://developer.qaip.com/api/v1/agent/threads/{thread_id}', 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://developer.qaip.com/api/v1/agent/threads/{thread_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://developer.qaip.com/api/v1/agent/threads/{thread_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://developer.qaip.com/api/v1/agent/threads/{thread_id}")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://developer.qaip.com/api/v1/agent/threads/{thread_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"thread_id": "<string>",
"runs": [
{
"run_id": "<string>",
"status": "QUEUED",
"parent_run_id": "<string>",
"title": "<string>",
"created_at": "2023-11-07T05:31:56Z"
}
]
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"request_id": "<string>",
"details": {},
"retryable": true
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"request_id": "<string>",
"details": {},
"retryable": true
}
}{
"error": {
"code": "unavailable",
"message": "The upstream service is unavailable.",
"request_id": "019d3200-0000-7000-8000-000000000001",
"retryable": false,
"details": {}
}
}References
Get an agent thread's run tree
Get the runs of a thread as a tree (via parent_run_id). Use it to detect branches (sibling runs from edit/regenerate) and pick a run to restore (restore via the run events endpoints).
Required scope: inference:run
GET
/
agent
/
threads
/
{thread_id}
Python
import os
from qaip import Qaip
client = Qaip(
api_key=os.environ.get("QAIP_API_KEY"), # This is the default and can be omitted
)
agent_thread_detail = client.agent.retrieve_thread(
thread_id="thread_id",
)
print(agent_thread_detail.thread_id)curl https://developer.qaip.com/api/v1/agent/threads/$THREAD_ID \
-H "x-api-key: $QAIP_API_KEY"const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://developer.qaip.com/api/v1/agent/threads/{thread_id}', 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://developer.qaip.com/api/v1/agent/threads/{thread_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://developer.qaip.com/api/v1/agent/threads/{thread_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://developer.qaip.com/api/v1/agent/threads/{thread_id}")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://developer.qaip.com/api/v1/agent/threads/{thread_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"thread_id": "<string>",
"runs": [
{
"run_id": "<string>",
"status": "QUEUED",
"parent_run_id": "<string>",
"title": "<string>",
"created_at": "2023-11-07T05:31:56Z"
}
]
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"request_id": "<string>",
"details": {},
"retryable": true
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"request_id": "<string>",
"details": {},
"retryable": true
}
}{
"error": {
"code": "unavailable",
"message": "The upstream service is unavailable.",
"request_id": "019d3200-0000-7000-8000-000000000001",
"retryable": false,
"details": {}
}
}Authorizations
API key for authentication
Path Parameters
Query Parameters
Scope by principal. If omitted, only a thread with no principal (principal_id is null) is returned; a thread whose principal differs yields 404.

