Events
Assistant stream events
During the execution of Runs with , a series of events occur sequentially, allowing you to track the current step in processing user Messages by the Assistant, as well as the statuses of the previously completed steps.
Every event in a server-sent events stream includes an event
and data
property:
We emit events whenever a new object is created, transitions to a new state, or is being streamed in parts (deltas). For example, we emit thread.run.created
when a new Run is created, thread.run.completed
when a Run completes, and so on. When an Assistant chooses to create a Message during a Run, we emit a thread.message.created
event, a thread.message.in_progress
event, many thread.message.delta
events, and finally a thread.message.completed
event.
We may add additional events over time, so we recommend handling unknown events gracefully in your code. See the this guide to learn how to integrate the Assistants API with streaming.
Event list
done
[DONE]
Occurs when a stream ends.
error
an error object
Occurs when an error occurs. This can happen due to an internal server error or a timeout.
thread.created
a thread object
Occurs when a new thread is created.
thread.message.completed
a message object
Occurs when a message is completed.
thread.message.created
a message object
Occurs when a message is created.
thread.message.delta
a message delta
Occurs when parts of a Message are being streamed.
thread.message.in_progress
a message object
Occurs when a message moves to an in_progress state.
thread.message.incomplete
a message object
Occurs when a message ends before it is completed.
thread.run.cancelled
a run object
Occurs when a run is cancelled.
thread.run.cancelling
a run object
Occurs when a run moves to a cancelling status.
thread.run.completed
a run object
Occurs when a run is completed.
thread.run.created
a run object
Occurs when a new run is created.
thread.run.expired
a run object
Occurs when a run expires.
thread.run.failed
a run object
Occurs when a run fails.
thread.run.in_progress
a run object
Occurs when a run moves to an in_progress status.
thread.run.incomplete
a run object
Occurs when a run ends with status incomplete.
thread.run.queued
a run object
Occurs when a run moves to a queued status.
thread.run.requires_action
a run object
Occurs when a run moves to a requires_action status.
thread.run.step.cancelled
a run step object
Occurs when a run step is cancelled.
thread.run.step.completed
a run step object
Occurs when a run step is completed.
thread.run.step.created
a run step object
Occurs when a run step is created.
thread.run.step.delta
a run step delta object
Occurs when parts of a run step are being streamed.
thread.run.step.expired
a run step object
Occurs when a run step expires.
thread.run.step.failed
a run step object
Occurs when a run step fails.
thread.run.step.in_progress
a run step object
Occurs when a run step moves to an in_progress state.
Last updated
Was this helpful?