Thread Object
string
Unique thread identifier (e.g.,
thr_123)string
Usually the first user message in the thread, if available
boolean
Whether the thread is ephemeral and should not be materialized on disk
string
Model provider used for this thread (e.g.,
openai)number
Unix timestamp (seconds) when the thread was created
number
Unix timestamp (seconds) when the thread was last updated
ThreadStatus
Current runtime status for the thread
string | null
Path to the thread rollout file on disk (null for ephemeral threads)
string
Working directory captured for the thread
Turn[]
Array of turns (only populated when explicitly requested)
Start a Thread
Create a new conversation thread with optional configuration.Method
Parameters
string
Model to use (e.g.,
gpt-5.1-codex)string
Model provider (e.g.,
openai)string
Working directory for the thread
string
Approval policy for commands and file changes
never- Never ask for approvaluntrusted- Ask for approval on untrusted operationson-request- Always ask for approvalon-failure- Ask for approval on failuresreject- Reject all approval requests
string
Sandbox mode
read-only- Read-only file system accessworkspace-write- Write access to workspacedanger-full-access- Full system access
string
Agent personality
friendly- Friendly and conversationalpragmatic- Direct and efficientnone- No personality modifier
string
Optional metrics tag (
service_name)Response
Thread
The created thread object
string
Active model for the thread
string
Active model provider
string
Working directory
string
Active approval policy
SandboxPolicy
Active sandbox policy
Notifications
notification
Emitted when the thread starts
Example
Resume a Thread
Reopen an existing thread by ID to continue the conversation.Method
Parameters
string
required
Thread ID to resume
string
Override personality for resumed thread
Response
Same asthread/start response.
Example
Fork a Thread
Branch from an existing thread into a new thread ID with copied history.Method
Parameters
string
required
Thread ID to fork from
Response
Thread
The newly created forked thread (with a new ID)
Notifications
notification
Emitted for the new forked thread
Example
List Threads
Page through stored rollouts with optional filtering and pagination.Method
Parameters
string
Opaque pagination cursor from previous response
number
Page size (server defaults if unset)
string
Sort key:
created_at (default) or updated_atstring[]
Filter by model providers (empty/null includes all)
string[]
Filter by source kinds (
cli, vscode, etc.)boolean
When
true, list archived threads only. When false/null, list non-archived threadsstring
Filter by exact working directory path
string
Filter by substring match in thread title (case-sensitive)
Response
Thread[]
Array of thread objects
string | null
Cursor for next page (null if no more pages)
Example
Read a Thread
Fetch a stored thread by ID without resuming it.Method
Parameters
string
required
Thread ID to read
boolean
default:false
When true, include turns and their items from rollout history
Response
Thread
Thread object with
status and optional turnsExample
Archive a Thread
Move a thread’s rollout file into the archived directory.Method
Parameters
string
required
Thread ID to archive
Response
object
Empty object on success
Notifications
notification
Emitted after successful archive
Example
Other Thread Operations
thread/unarchive
Move an archived thread back to sessions directoryReturns: Restored
thread objectthread/name/set
Set or update a thread’s user-facing nameReturns: Empty object
{}thread/loaded/list
List thread IDs currently loaded in memoryReturns:
{ data: string[], nextCursor: string | null }thread/unsubscribe
Unsubscribe from thread events (unloads if last subscriber)Returns:
{ status: "unsubscribed" | "notSubscribed" | "notLoaded" }thread/rollback
Drop last N turns from thread historyReturns: Updated
thread with turns populatedthread/compact/start
Trigger conversation history compactionReturns: Empty object
{} (progress via notifications)Thread Notifications
Emitted when a new thread starts or forks
Emitted when a loaded thread’s status changes
Emitted after archiving a thread
Emitted after unarchiving a thread
Emitted when a thread is unloaded (no more subscribers)
Emitted when a thread’s name changes
Emitted with token usage updates during turns
Next Steps
Turns
Send user input and start a turn
Items
Understand turn items and streaming