run_steps
Creates, updates, deletes, gets or lists a run_steps resource.
Overview
| Name | run_steps |
| Type | Resource |
| Id | openai.assistants.run_steps |
Fields
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
id | string | The identifier of the run step, which can be referenced in API endpoints. |
assistant_id | string | The ID of the assistant associated with the run step. |
run_id | string | The ID of the run that this run step is a part of. |
thread_id | string | The ID of the thread that was run. |
cancelled_at | integer (unixtime) | The Unix timestamp (in seconds) for when the run step was cancelled. |
completed_at | integer (unixtime) | The Unix timestamp (in seconds) for when the run step completed. |
created_at | integer (unixtime) | The Unix timestamp (in seconds) for when the run step was created. |
expired_at | integer (unixtime) | The Unix timestamp (in seconds) for when the run step expired. A step is considered expired if the parent run is expired. |
failed_at | integer (unixtime) | The Unix timestamp (in seconds) for when the run step failed. |
last_error | object | The last error associated with this run step. Will be null if there are no errors. |
metadata | object | Set 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) |
object | string | The object type, which is always thread.run.step. (thread.run.step) |
status | string | The status of the run step, which can be either in_progress, cancelled, failed, completed, or expired. (in_progress, cancelled, failed, completed, expired) |
step_details | object | The details of the run step. (title: Message creation) |
type | string | The type of run step, which can be either message_creation or tool_calls. (message_creation, tool_calls) |
usage | object | Usage statistics related to the run step. This value will be null while the run step's status is in_progress. |
| Name | Datatype | Description |
|---|---|---|
id | string | The identifier of the run step, which can be referenced in API endpoints. |
assistant_id | string | The ID of the assistant associated with the run step. |
run_id | string | The ID of the run that this run step is a part of. |
thread_id | string | The ID of the thread that was run. |
cancelled_at | integer (unixtime) | The Unix timestamp (in seconds) for when the run step was cancelled. |
completed_at | integer (unixtime) | The Unix timestamp (in seconds) for when the run step completed. |
created_at | integer (unixtime) | The Unix timestamp (in seconds) for when the run step was created. |
expired_at | integer (unixtime) | The Unix timestamp (in seconds) for when the run step expired. A step is considered expired if the parent run is expired. |
failed_at | integer (unixtime) | The Unix timestamp (in seconds) for when the run step failed. |
last_error | object | The last error associated with this run step. Will be null if there are no errors. |
metadata | object | Set 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) |
object | string | The object type, which is always thread.run.step. (thread.run.step) |
status | string | The status of the run step, which can be either in_progress, cancelled, failed, completed, or expired. (in_progress, cancelled, failed, completed, expired) |
step_details | object | The details of the run step. (title: Message creation) |
type | string | The type of run step, which can be either message_creation or tool_calls. (message_creation, tool_calls) |
usage | object | Usage 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:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | thread_id, run_id, step_id | include[], openai-organization, openai-project | |
list | select | thread_id, run_id | limit, 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.
| Name | Datatype | Description |
|---|---|---|
run_id | string | The ID of the run the run steps belong to. |
step_id | string | The ID of the run step to retrieve. |
thread_id | string | The ID of the thread the run and run steps belong to. |
after | string | A 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. |
before | string | A 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[] | array | A 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. |
limit | integer | A 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-organization | string | Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as openai_organization. |
openai-project | string | Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as openai_project. |
order | string | Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. |
SELECT examples
- get
- list
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 }}'
;
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 "order" = '{{ order }}'
AND after = '{{ after }}'
AND before = '{{ before }}'
AND include[] = '{{ include[] }}'
AND "openai-organization" = '{{ openai-organization }}'
AND "openai-project" = '{{ openai-project }}'
;