Threads AI

TeamRunResult

What TeamAgent.run returns: a RunResult whose every variant also carries team.

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.

teamTeamrequired

The team's handle, whatever the status: start, send, ask, wait and cancel members from your code.

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.

teamTeamrequired

The team's handle, whatever the status: start, send, ask, wait and cancel members from your code.

cancelled

status"cancelled"required

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

threadThreadrequired

A thread positioned at one branch.

teamTeamrequired

The team's handle, whatever the status: start, send, ask, wait and cancel members from your code.

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.

teamTeamrequired

The team's handle, whatever the status: start, send, ask, wait and cancel members from your code.

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.

teamTeamrequired

The team's handle, whatever the status: start, send, ask, wait and cancel members from your code.

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.

teamTeamrequired

The team's handle, whatever the status: start, send, ask, wait and cancel members from your code.

Edit on GitHub

On this page