Thread Object
Unique thread identifier (e.g.,
thr_123)Usually the first user message in the thread, if available
Whether the thread is ephemeral and should not be materialized on disk
Model provider used for this thread (e.g.,
openai)Unix timestamp (seconds) when the thread was created
Unix timestamp (seconds) when the thread was last updated
Current runtime status for the thread
Path to the thread rollout file on disk (null for ephemeral threads)
Working directory captured for the thread
Array of turns (only populated when explicitly requested)
Start a Thread
Create a new conversation thread with optional configuration.Method
Parameters
Model to use (e.g.,
gpt-5.1-codex)Model provider (e.g.,
openai)Working directory for the thread
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
Sandbox mode
read-only- Read-only file system accessworkspace-write- Write access to workspacedanger-full-access- Full system access
Agent personality
friendly- Friendly and conversationalpragmatic- Direct and efficientnone- No personality modifier
Optional metrics tag (
service_name)Response
The created thread object
Active model for the thread
Active model provider
Working directory
Active approval policy
Active sandbox policy
Notifications
Emitted when the thread starts
Example
Resume a Thread
Reopen an existing thread by ID to continue the conversation.Method
Parameters
Thread ID to resume
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
Thread ID to fork from
Response
The newly created forked thread (with a new ID)
Notifications
Emitted for the new forked thread
Example
List Threads
Page through stored rollouts with optional filtering and pagination.Method
Parameters
Opaque pagination cursor from previous response
Page size (server defaults if unset)
Sort key:
created_at (default) or updated_atFilter by model providers (empty/null includes all)
Filter by source kinds (
cli, vscode, etc.)When
true, list archived threads only. When false/null, list non-archived threadsFilter by exact working directory path
Filter by substring match in thread title (case-sensitive)
Response
Array of thread objects
Cursor for next page (null if no more pages)
Example
Read a Thread
Fetch a stored thread by ID without resuming it.Method
Parameters
Thread ID to read
When true, include turns and their items from rollout history
Response
Thread object with
status and optional turnsExample
Archive a Thread
Move a thread’s rollout file into the archived directory.Method
Parameters
Thread ID to archive
Response
Empty object on success
Notifications
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
thread/started
Emitted when a new thread starts or forks
thread/status/changed
Emitted when a loaded thread’s status changes
thread/archived
Emitted after archiving a thread
thread/unarchived
Emitted after unarchiving a thread
thread/closed
Emitted when a thread is unloaded (no more subscribers)
thread/name/updated
Emitted when a thread’s name changes
thread/tokenUsage/updated
Emitted with token usage updates during turns
Next Steps
Turns
Send user input and start a turn
Items
Understand turn items and streaming