Skip to content



All async methods that have an _async suffix have sync equivalents that can be called with out the suffix e.g. run() and await run_async().


The Run class represents a single execution of an assistant.


Name Type Description
thread Thread

The thread in which the run is executed.

assistant Assistant

The assistant that is being run.

instructions str

Replacement instructions for the run.

additional_instructions str

Additional instructions to append to the assistant's instructions.

tools list[Union[AssistantTool, Callable]]

Replacement tools for the run.

additional_tools list[AssistantTool]

Additional tools to append to the assistant's tools.

run Run

The OpenAI run object.

data Any

Any additional data associated with the run.

cancel_async async

Cancels the run.

refresh_async async

Refreshes the run.

run_async async

Excutes a run asynchronously.


refresh_run_steps_async async

Asynchronously refreshes and updates the run steps list.

This function fetches the latest run steps up to a specified limit and checks if the latest run step in the current run steps list (self.steps) is included in the new batch. If the latest run step is missing, it continues to fetch additional run steps in batches, up to a maximum count, using pagination. The function then updates self.steps with these new run steps, ensuring any existing run steps are updated with their latest versions and new run steps are appended in their original order.