Threads
curl --request GET \
--url https://api.example.com/v1/threadsimport requests
url = "https://api.example.com/v1/threads"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/v1/threads', 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/threads",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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://api.example.com/v1/threads"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/v1/threads")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/threads")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_bodyAgents
Threads
Read, update, delete, stream, and publish thread events
GET
/
v1
/
threads
Threads
curl --request GET \
--url https://api.example.com/v1/threadsimport requests
url = "https://api.example.com/v1/threads"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/v1/threads', 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/threads",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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://api.example.com/v1/threads"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/v1/threads")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/threads")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_bodyThreads are the canonical cloud conversation surface. Durable events are stored as JSONL in workspace storage and projected into
Pass exactly one of
Transient frame types:
Transient frames require
agent_threads and thread_rollouts for fast listing; transient token/reasoning deltas are live-only WebSocket frames. Reach for threads when you want conversation history, multi-client live updates, compaction, or local-device runs that publish back into cloud history.
Thread Management
| Method | Path | Scope | Description |
|---|---|---|---|
GET | /v1/threads | agent:read | List visible threads |
GET | /v1/threads/{threadId} | agent:read | Get a thread snapshot |
GET | /v1/threads/{threadId}/events | agent:read | Read durable event history |
GET | /v1/threads/{threadId}/rollouts | agent:read | List compaction rollouts |
GET | /v1/threads/{threadId}/activity | activity:read | Read customer-visible activity for the thread |
PATCH | /v1/threads/{threadId} | agent:run | Rename or archive a thread |
DELETE | /v1/threads/{threadId} | agent:run | Delete a thread |
POST | /v1/threads/{threadId}/compact | agent:run | Request compaction |
number
default:"50"
List endpoints cap
limit at 100 for thread lists and 500 for event reads.string
Cursor returned in
meta.nextCursor.boolean
Include archived threads when listing.
string
Use
include=all_rollouts on snapshot or event reads when you need non-active rollout history.cURL
curl "https://api.runtools.ai/v1/threads?limit=25" \
-H "X-API-Key: $RUNTOOLS_API_KEY"
cURL
curl "https://api.runtools.ai/v1/threads/thr_abc123/events?limit=200" \
-H "X-API-Key: $RUNTOOLS_API_KEY"
Live WebSocket
Subscribe to live thread frames:wss://api.runtools.ai/v1/threads/{threadId}/events?api_key=<key>
wss://api.runtools.ai/v1/threads/{threadId}/events?token=<session-token>
api_key or token. The first frame is a snapshot for the owner, or a metadata-only snapshot for admin broader-view access.
Common live frames:
| Frame | Durable? | Description |
|---|---|---|
snapshot | No | Initial full snapshot with protocol_version: 1 |
run_started / run_completed | Yes | Run lifecycle |
user_message / assistant_message | Yes | Final persisted messages |
tool_call / tool_result | Yes | Persisted tool lifecycle and final output |
assistant_message_delta | No | Token deltas |
assistant_thinking_delta | No | Reasoning deltas |
assistant_message_source | No | Source/citation deltas |
tool_call_started / tool_output_delta / tool_call_completed | No | Live tool execution output |
compaction_started / compaction_completed | Yes | Rollout lifecycle |
thread_archived / thread_deleted / thread_renamed | No | Metadata updates |
Publish Thread Events
Public clients that execute local runs, such as the desktop sidecar, publish throughPOST /v1/thread-events. This route requires user or API-key auth and rejects internal service headers.
Durable frame types:
run_started, run_completed, user_message, assistant_message, tool_call, tool_result
assistant_message_delta, assistant_thinking_delta, assistant_message_source,
tool_call_started, tool_output_delta, tool_call_completed
threadId, runId, rolloutId, and a positive sequenceNumber. They fan out to WebSocket subscribers but do not write JSONL or bump durable thread timestamps.
cURL
curl -X POST https://api.runtools.ai/v1/thread-events \
-H "X-API-Key: $RUNTOOLS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"threadId": "thr_abc123",
"frame": {
"type": "assistant_message_delta",
"runId": "run_abc123",
"rolloutId": "001",
"messageId": "msg_abc123",
"sequenceNumber": 1,
"delta": "Hello"
}
}'
Thread Busy
Only one active run may write a thread at a time. Starting another run on a busy thread returns409 THREAD_BUSY.