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.
Errors that may occur while working with Assistants
401 - Invalid Authentication
Cause: Invalid Authentication Solution: Ensure the correct AIML API key and requesting organization are being used.
401 - Incorrect API key provided
403 - Country, region, or territory not supported
429 - Rate limit reached for requests
429 - You exceeded your current quota, please check your plan and billing details
500 - The server had an error while processing your request
Cause: Issue on our servers. Solution: Retry your request after a brief wait and contact us if the issue persists.
503 - The engine is currently overloaded, please try again later
Cause: Our servers are experiencing high traffic. Solution: Please retry your requests after a brief wait.
503 - Slow Down
Cause: A sudden increase in your request rate is impacting service reliability. Solution: Please reduce your request rate to its original level, maintain a consistent rate for at least 15 minutes, and then gradually increase it.
Last updated
Was this helpful?