Skip to main content

run_steps

Creates, updates, deletes, gets or lists a run_steps resource.

Overview

Namerun_steps
TypeResource
Idopenai.assistants.run_steps

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringThe identifier of the run step, which can be referenced in API endpoints.
assistant_idstringThe ID of the assistant associated with the run step.
run_idstringThe ID of the run that this run step is a part of.
thread_idstringThe ID of the thread that was run.
cancelled_atinteger (unixtime)The Unix timestamp (in seconds) for when the run step was cancelled.
completed_atinteger (unixtime)The Unix timestamp (in seconds) for when the run step completed.
created_atinteger (unixtime)The Unix timestamp (in seconds) for when the run step was created.
expired_atinteger (unixtime)The Unix timestamp (in seconds) for when the run step expired. A step is considered expired if the parent run is expired.
failed_atinteger (unixtime)The Unix timestamp (in seconds) for when the run step failed.
last_errorobjectThe last error associated with this run step. Will be null if there are no errors.
metadataobjectSet of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. (x-oaiTypeLabel: map)
objectstringThe object type, which is always thread.run.step. (thread.run.step)
statusstringThe status of the run step, which can be either in_progress, cancelled, failed, completed, or expired. (in_progress, cancelled, failed, completed, expired)
step_detailsobjectThe details of the run step. (title: Message creation)
typestringThe type of run step, which can be either message_creation or tool_calls. (message_creation, tool_calls)
usageobjectUsage statistics related to the run step. This value will be null while the run step's status is in_progress.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectthread_id, run_id, step_idinclude[], openai-organization, openai-project
listselectthread_id, run_idlimit, order, after, before, include[], openai-organization, openai-project

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
run_idstringThe ID of the run the run steps belong to.
step_idstringThe ID of the run step to retrieve.
thread_idstringThe ID of the thread the run and run steps belong to.
afterstringA cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
beforestringA cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
include[]arrayA list of additional fields to include in the response. Currently the only supported value is step_details.tool_calls[*].file_search.results[*].content to fetch the file search result content. See the file search tool documentation for more information.
limitintegerA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Automatically applied from a SQL LIMIT clause - SELECT ... LIMIT 10 sends limit=10 on the wire. Setting it explicitly in a WHERE clause is not required.
openai-organizationstringOptionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as openai_organization.
openai-projectstringOptionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as openai_project.
orderstringSort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.

SELECT examples

OK

SELECT
id,
assistant_id,
run_id,
thread_id,
cancelled_at,
completed_at,
created_at,
expired_at,
failed_at,
last_error,
metadata,
object,
status,
step_details,
type,
usage
FROM openai.assistants.run_steps
WHERE thread_id = '{{ thread_id }}' -- required
AND run_id = '{{ run_id }}' -- required
AND step_id = '{{ step_id }}' -- required
AND include[] = '{{ include[] }}'
AND "openai-organization" = '{{ openai-organization }}'
AND "openai-project" = '{{ openai-project }}'
;