Threads AI

RunResult

What a run ended with.

thread is the Thread handle in both languages: read it (usage(), timeline(), fork()) or pass it back to run() to continue. In TypeScript the handle holds functions, so it can't be structured-cloned; to send a result elsewhere, send thread.id and thread.branch. The HTTP form is host-api RunOutcome (ids instead of handles).

A union discriminated by status.

completed

status"completed"required

"completed": the run finished, and output holds its final answer.

outputOutputrequired

The final answer: the text of the run's last lead turn (after the last wake, when members or background subagents reported), or in TypeScript the value parsed by the agent's output schema when it has one. Earlier answers stay in the thread's timeline.

threadThreadrequired

A thread positioned at one branch.

parked

status"parked"required

"parked": the run is waiting on a person, such as an approval or an effect whose outcome is unknown, or on a member it started that parked; pending lists what it waits on. Answer them with the Thread methods to let it continue.

reasonParkedEvent.data.reasonrequired

awaiting_input: an ask_user question; the address is {kind: input, id: <call_id>}.

pendingreadonly ParkAddress[]required

What a parked branch waits on; resumed must name the same address.

threadThreadrequired

A thread positioned at one branch.

cancelled

status"cancelled"required

"cancelled": the thread was cancelled before the run finished.

threadThreadrequired

A thread positioned at one branch.

failed

status"failed"required

"failed": the run ended with an error; error says which.

error{ code: RunErrorCode; message: string }required

Why the run failed: a code and a readable message.

error.codeRunErrorCoderequired

What went wrong, for example model_unavailable, max_turns, output_invalid or branch_busy.

error.messagestringrequired

A readable explanation of the failure, for logs and people.

threadThreadrequired

A thread positioned at one branch.

budget_exhausted

status"budget_exhausted"required

"budget_exhausted": a budget limit was reached before the next model request; budget says which.

budgetBudgetExceededEvent.datarequired

Which limit was hit and its value, how much was used, and whether the budget was this thread's own or an ancestor's.

threadThreadrequired

A thread positioned at one branch.

handed_off

status"handed_off"required

"handed_off": the agent handed the conversation to another agent; to_thread is that agent's thread.

threadThreadrequired

A thread positioned at one branch.

toThread / to_threadThreadrequired

A thread positioned at one branch.

Edit on GitHub

On this page