🔄 Runs Official Documentation

â‹™ Create Thread and Run

Create a thread and run it in one request.

msg.payload Properties

assistant_id string
The ID of the assistant to use to execute this run.
thread object
A thread object to create with the run.
model string
The ID of the Model to be used to execute this run.
instructions string
Override the default system message of the assistant.
tools array
Override the tools the assistant can use for this run.
tool_resources object or null
A set of resources that are used by the assistant's tools.
metadata object
Set of 16 key-value pairs that can be attached to an object.
temperature number
What sampling temperature to use, between 0 and 2.
top_p number or null
An alternative to sampling with temperature.
stream boolean
If true, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a data: [DONE] message.
max_prompt_tokens integer
The maximum number of prompt tokens that may be used over the course of the run.
max_completion_tokens integer
The maximum number of completion tokens that may be used over the course of the run.
truncation_strategy object
@property {string} type - The truncation strategy to use for the thread. The default is auto. If set to last_messages, the thread will be truncated to the n most recent messages in the thread. When set to auto, messages in the middle of the thread will be dropped to fit the context length of the model, max_prompt_tokens.
@property {integer} [last_messages] - The number of most recent messages from the thread when constructing the context for the run.
tool_choice string | object
Controls which (if any) tool is called by the model. none means the model will not call any tools and instead generates a message. auto is the default value and means the model can pick between generating a message or calling a tool. Specifying a particular tool like {"type": "TOOL_TYPE"} forces the model to call that tool.
parallel_tool_calls boolean
Whether to enable parallel function calling during tool use.
response_format string | object
Specifies the format that the model must output.

â‹™ List Runs

Returns a list of runs belonging to a thread.

msg.payload Properties

thread_id string
The ID of the thread the run belongs to.
limit integer
A limit on the number of objects to be returned.
order string
Sort order by the created_at timestamp of the objects.
after string
A cursor for use in pagination.
before string
A cursor for use in pagination.

â‹™ Create Run

Create a run.

msg.payload Properties

thread_id string
The ID of the thread to run.
include array
A list of additional fields to include in the response.
assistant_id string
The ID of the assistant to use to execute this run.
model string
The ID of the Model to be used to execute this run.
instructions string
Overrides the instructions of the assistant. This is useful for modifying the behavior on a per-run basis.
additional_instructions string
Appends additional instructions at the end of the instructions for the run. This is useful for modifying the behavior on a per-run basis without overriding other instructions.
additional_messages array
Adds additional messages to the thread before creating the run.
tools array
Override the tools the assistant can use for this run.
metadata object
Set of 16 key-value pairs that can be attached to an object.
temperature number
What sampling temperature to use, between 0 and 2.
top_p number
An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass.
stream boolean
If true, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a data: [DONE] message.
max_prompt_tokens integer
The maximum number of prompt tokens that may be used over the course of the run.
max_completion_tokens integer
The maximum number of completion tokens that may be used over the course of the run.
truncation_strategy object
Controls for how a thread will be truncated prior to the run.
tool_choice string or object
Controls for how a thread will be truncated prior to the run.
parallel_tool_calls boolean
Whether to enable parallel function calling during tool use.
response_format string or object
Specifies the format that the model must output.

â‹™ Retrieve Run

Retrieves a run.

msg.payload Properties

thread_id string
The ID of the thread that was run.
run_id string
The ID of the run to retrieve.

â‹™ Modify Run

Modifies a run.

msg.payload Properties

thread_id string
The ID of the thread that was run.
run_id string
The ID of the run to modify.
metadata object
Set of 16 key-value pairs that can be attached to an object.

â‹™ Submit Tool Outputs to Run

When a run has the `status: "requires_action"` and `required_action.type` is `submit_tool_outputs`, this endpoint can be used to submit the outputs from the tool calls once they're all completed. All outputs must be submitted in a single request.

msg.payload Properties

thread_id string
The ID of the thread to which this run belongs.
run_id string
The ID of the run that requires the tool output submission.
tool_outputs array
A list of tools for which the outputs are being submitted.
stream boolean
If true, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a data: [DONE] message.

â‹™ Cancel Run

Cancels a run that is `in_progress`.

msg.payload Properties

thread_id string
The ID of the thread to which this run belongs.
run_id string
The ID of the run to cancel.

â‹™ List Run Steps

Returns a list of run steps belonging to a run.

msg.payload Properties

thread_id string
The ID of the thread the run and run steps belong to.
run_id string
The ID of the run the run steps belong to.
limit integer
A limit on the number of objects to be returned.
order string
Sort order by the created_at timestamp of the objects.
after string
A cursor for use in pagination.
before string
A cursor for use in pagination.
include array
A list of additional fields to include in the response.

â‹™ Retrieve Run Step

Retrieves a run step.

msg.payload Properties

thread_id string
The ID of the thread to which the run and run step belongs.
run_id string
The ID of the run to which the run step belongs.
step_id string
The ID of the run step to retrieve.
include array
A list of additional fields to include in the response.