Share via


CreateRunOptions interface

The details used when creating a new run of an agent thread.

Properties

additionalInstructions

Additional instructions to append 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.

additionalMessages

Adds additional messages to the thread before creating the run.

assistantId

The ID of the agent that should run the thread.

instructions

The overridden system instructions that the agent should use to run the thread.

maxCompletionTokens

The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status incomplete. See incomplete_details for more info.

maxPromptTokens

The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status incomplete. See incomplete_details for more info.

metadata

A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.

model

The overridden model name that the agent should use to run the thread.

parallelToolCalls

If true functions will run in parallel during tool use.

responseFormat

Specifies the format that the model must output.

stream

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.

temperature

What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.

toolChoice

Controls whether or not and which tool is called by the model.

tools

The overridden list of enabled tools that the agent should use to run the thread.

topP

An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

We generally recommend altering this or temperature but not both.

truncationStrategy

The strategy to use for dropping messages as the context windows moves forward.

Property Details

additionalInstructions

Additional instructions to append 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.

additionalInstructions?: null | string

Property Value

null | string

additionalMessages

Adds additional messages to the thread before creating the run.

additionalMessages?: null | ThreadMessageOptions[]

Property Value

assistantId

The ID of the agent that should run the thread.

assistantId: string

Property Value

string

instructions

The overridden system instructions that the agent should use to run the thread.

instructions?: null | string

Property Value

null | string

maxCompletionTokens

The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status incomplete. See incomplete_details for more info.

maxCompletionTokens?: null | number

Property Value

null | number

maxPromptTokens

The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status incomplete. See incomplete_details for more info.

maxPromptTokens?: null | number

Property Value

null | number

metadata

A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.

metadata?: null | Record<string, string>

Property Value

null | Record<string, string>

model

The overridden model name that the agent should use to run the thread.

model?: null | string

Property Value

null | string

parallelToolCalls

If true functions will run in parallel during tool use.

parallelToolCalls?: boolean

Property Value

boolean

responseFormat

Specifies the format that the model must output.

responseFormat?: null | AgentsApiResponseFormatOption

Property Value

stream

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.

stream?: boolean

Property Value

boolean

temperature

What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.

temperature?: null | number

Property Value

null | number

toolChoice

Controls whether or not and which tool is called by the model.

toolChoice?: null | AgentsApiToolChoiceOption

Property Value

tools

The overridden list of enabled tools that the agent should use to run the thread.

tools?: null | ToolDefinition[]

Property Value

null | ToolDefinition[]

topP

An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

We generally recommend altering this or temperature but not both.

topP?: null | number

Property Value

null | number

truncationStrategy

The strategy to use for dropping messages as the context windows moves forward.

truncationStrategy?: null | TruncationObject

Property Value