Share via


@azure/ai-agents package

Classes

AgentsClient
ToolSet

Represents a set of tools with their definitions and resources.

ToolUtility

Utility class for creating various tools.

Interfaces

AISearchIndexResource

A AI Search Index resource.

Agent

Represents an agent that can call the model and use tools.

AgentDeletionStatus

The status of an agent deletion operation.

AgentEventMessage

Each event in a server-sent events stream has an event and data property: * *

Example

  • event: thread.created
  • data: {"id": "thread_123", "object": "thread", ...}
  • We emit events whenever a new object is created, transitions to a new state, or is being
  • streamed in parts (deltas). For example, we emit thread.run.created when a new run
  • is created, thread.run.completed when a run completes, and so on. When an Agent chooses
  • to create a message during a run, we emit a thread.message.created event, a
  • thread.message.in_progress event, many thread.message.delta events, and finally a
  • thread.message.completed event.
  • We may add additional events over time, so we recommend handling unknown events gracefully
  • in your code.
AgentEventMessageStream

Represents a stream of agent event message.

AgentThread

Information about a single thread associated with an agent.

AgentThreadCreationOptions

The details used to create a new agent thread.

AgentsClientOptionalParams

Optional parameters for the client.

AgentsNamedToolChoice

Specifies a tool the model should use. Use to force the model to call a specific tool.

AgentsResponseFormat

An object describing the expected output of the model. If json_object only function type tools are allowed to be passed to the Run. If text the model can return text or any value needed.

AzureAISearchResource

A set of index resources used by the azure_ai_search tool.

AzureAISearchToolDefinition

The input definition information for an Azure AI search tool as used to configure an agent.

AzureFunctionBinding

The structure for keeping storage queue name and URI.

AzureFunctionDefinition

The definition of Azure function.

AzureFunctionStorageQueue

The structure for keeping storage queue name and URI.

AzureFunctionToolDefinition

The input definition information for a azure function tool as used to configure an agent.

BingCustomSearchConfiguration

A bing custom search configuration.

BingCustomSearchConfigurationList

A list of search configurations currently used by the bing_custom_search tool.

BingCustomSearchToolDefinition

The input definition information for a Bing custom search tool as used to configure an agent.

BingGroundingSearchConfiguration

Search configuration for Bing Grounding

BingGroundingSearchConfigurationList

A list of search configurations currently used by the bing_grounding tool.

BingGroundingToolDefinition

The input definition information for a bing grounding search tool as used to configure an agent.

CodeInterpreterToolDefinition

The input definition information for a code interpreter tool as used to configure an agent.

CodeInterpreterToolResource

A set of resources that are used by the code_interpreter tool.

ConnectedAgentDetails

Information for connecting one agent to another as a tool

ConnectedAgentToolDefinition

The input definition information for a connected agent tool which defines a ___domain specific sub-agent

CreateAgentOptionalParams

Optional parameters.

CreateThreadAndRunOptionalParams

Optional parameters.

DeleteAgentOptionalParams

Optional parameters.

FileDeletionStatus

A status response from a file deletion operation.

FileInfo

Represents an agent that can call the model and use tools.

FileListResponse

The response data from a file list operation.

FileSearchRankingOptions

Ranking options for file search.

FileSearchToolCallContent

The file search result content object.

FileSearchToolDefinition

The input definition information for a file search tool as used to configure an agent.

FileSearchToolDefinitionDetails

Options overrides for the file search tool.

FileSearchToolResource

A set of resources that are used by the file_search tool.

FilesDeleteFileOptionalParams

Optional parameters.

FilesGetFileContentOptionalParams

Optional parameters.

FilesGetFileOptionalParams

Optional parameters.

FilesListFilesOptionalParams

Optional parameters.

FilesOperations

Interface representing a Files operations.

FilesUploadFileOptionalParams

Optional parameters.

FunctionDefinition

The input definition information for a function.

FunctionName

The function name that will be used, if using the function tool

FunctionToolDefinition

The input definition information for a function tool as used to configure an agent.

GetAgentOptionalParams

Optional parameters.

IncompleteRunDetails

Details on why the run is incomplete. Will be null if the run is not incomplete.

ListAgentsOptionalParams

Optional parameters.

MessageAttachment

This describes to which tools a file has been attached.

MessageContent

An abstract representation of a single item of thread message content.

MessageDelta

Represents the typed 'delta' payload within a streaming message delta chunk.

MessageDeltaChunk

Represents a message delta i.e. any changed fields on a message during streaming.

MessageDeltaContent

The abstract base representation of a partial streamed message content payload.

MessageDeltaImageFileContent

Represents a streamed image file content part within a streaming message delta chunk.

MessageDeltaImageFileContentObject

Represents the 'image_file' payload within streaming image file content.

MessageDeltaTextAnnotation

The abstract base representation of a streamed text content part's text annotation.

MessageDeltaTextContent

Represents a streamed text content part within a streaming message delta chunk.

MessageDeltaTextContentObject

Represents the data of a streamed text content part within a streaming message delta chunk.

MessageDeltaTextFileCitationAnnotation

Represents a streamed file citation applied to a streaming text content part.

MessageDeltaTextFileCitationAnnotationObject

Represents the data of a streamed file citation as applied to a streaming text content part.

MessageDeltaTextFilePathAnnotation

Represents a streamed file path annotation applied to a streaming text content part.

MessageDeltaTextFilePathAnnotationObject

Represents the data of a streamed file path annotation as applied to a streaming text content part.

MessageDeltaTextUrlCitationAnnotation

A citation within the message that points to a specific URL associated with the message. Generated when the agent uses tools such as 'bing_grounding' to search the Internet.

MessageDeltaTextUrlCitationDetails

A representation of a URL citation, as used in text thread message content.

MessageImageFileContent

A representation of image file content in a thread message.

MessageImageFileDetails

An image reference, as represented in thread message content.

MessageImageFileParam

Defines how an internally uploaded image file is referenced when creating an image-file block.

MessageImageUrlParam

Defines how an external image URL is referenced when creating an image-URL block.

MessageIncompleteDetails

Information providing additional detail about a message entering an incomplete status.

MessageInputContentBlock

Defines a single content block when creating a message. The 'type' field determines whether it is text, an image file, or an external image URL, etc.

MessageInputImageFileBlock

An image-file block in a new message, referencing an internally uploaded image by file ID.

MessageInputImageUrlBlock

An image-URL block in a new message, referencing an external image by URL.

MessageInputTextBlock

A text block in a new message, containing plain text content.

MessageTextAnnotation

An abstract representation of an annotation to text thread message content.

MessageTextContent

A representation of a textual item of thread message content.

MessageTextDetails

The text and associated annotations for a single item of agent thread message content.

MessageTextFileCitationAnnotation

A citation within the message that points to a specific quote from a specific File associated with the agent or the message. Generated when the agent uses the 'file_search' tool to search files.

MessageTextFileCitationDetails

A representation of a file-based text citation, as used in a file-based annotation of text thread message content.

MessageTextFilePathAnnotation

A citation within the message that points to a file located at a specific path.

MessageTextFilePathDetails

An encapsulation of an image file ID, as used by message image content.

MessageTextUrlCitationAnnotation

A citation within the message that points to a specific URL associated with the message. Generated when the agent uses tools such as 'bing_grounding' to search the Internet.

MessageTextUrlCitationDetails

A representation of a URL citation, as used in text thread message content.

MessagesCreateMessageOptionalParams

Optional parameters.

MessagesGetMessageOptionalParams

Optional parameters.

MessagesListMessagesOptionalParams

Optional parameters.

MessagesOperations

Interface representing a Messages operations.

MessagesUpdateMessageOptionalParams

Optional parameters.

MicrosoftFabricToolDefinition

The input definition information for a Microsoft Fabric tool as used to configure an agent.

OpenApiAnonymousAuthDetails

Security details for OpenApi anonymous authentication

OpenApiAuthDetails

authentication details for OpenApiFunctionDefinition

OpenApiConnectionAuthDetails

Security details for OpenApi connection authentication

OpenApiConnectionSecurityScheme

Security scheme for OpenApi managed_identity authentication

OpenApiFunctionDefinition

The input definition information for an openapi function.

OpenApiManagedAuthDetails

Security details for OpenApi managed_identity authentication

OpenApiManagedSecurityScheme

Security scheme for OpenApi managed_identity authentication

OpenApiToolDefinition

The input definition information for an OpenAPI tool as used to configure an agent.

PageSettings

Options for the byPage method

PagedAsyncIterableIterator

An interface that allows async iterable iteration both to completion and by page.

PollingOptions

Options for configuring polling behavior.

PollingOptionsParams

Optional parameters configuring polling behavior.

RequiredAction

An abstract representation of a required action for an agent thread run to continue.

RequiredFunctionToolCall

A representation of a requested call to a function tool, needed by the model to continue evaluation of a run.

RequiredFunctionToolCallDetails

The detailed information for a function invocation, as provided by a required action invoking a function tool, that includes the name of and arguments to the function.

RequiredToolCall

An abstract representation of a tool invocation needed by the model to continue a run.

ResponseFormatJsonSchema

A description of what the response format is for, used by the model to determine how to respond in the format.

ResponseFormatJsonSchemaType

The type of response format being defined: json_schema

RunCompletionUsage

Usage statistics related to the run. This value will be null if the run is not in a terminal state (i.e. in_progress, queued, etc.).

RunError

The details of an error as encountered by an agent thread run.

RunStep

Detailed information about a single step of an agent thread run.

RunStepAzureAISearchToolCall

A record of a call to an Azure AI Search tool, issued by the model in evaluation of a defined tool, that represents executed Azure AI search.

RunStepBingCustomSearchToolCall

A record of a call to a bing custom search tool, issued by the model in evaluation of a defined tool, that represents executed search with bing custom search.

RunStepBingGroundingToolCall

A record of a call to a bing grounding tool, issued by the model in evaluation of a defined tool, that represents executed search with bing grounding.

RunStepCodeInterpreterImageOutput

A representation of an image output emitted by a code interpreter tool in response to a tool call by the model.

RunStepCodeInterpreterImageReference

An image reference emitted by a code interpreter tool in response to a tool call by the model.

RunStepCodeInterpreterLogOutput

A representation of a log output emitted by a code interpreter tool in response to a tool call by the model.

RunStepCodeInterpreterToolCall

A record of a call to a code interpreter tool, issued by the model in evaluation of a defined tool, that represents inputs and outputs consumed and emitted by the code interpreter.

RunStepCodeInterpreterToolCallDetails

The detailed information about a code interpreter invocation by the model.

RunStepCodeInterpreterToolCallOutput

An abstract representation of an emitted output from a code interpreter tool.

RunStepCompletionUsage

Usage statistics related to the run step.

RunStepDelta

Represents the delta payload in a streaming run step delta chunk.

RunStepDeltaChunk

Represents a run step delta i.e. any changed fields on a run step during streaming.

RunStepDeltaCodeInterpreterDetailItemObject

Represents the Code Interpreter tool call data in a streaming run step's tool calls.

RunStepDeltaCodeInterpreterImageOutput

Represents an image output as produced the Code interpreter tool and as represented in a streaming run step's delta tool calls collection.

RunStepDeltaCodeInterpreterImageOutputObject

Represents the data for a streaming run step's Code Interpreter tool call image output.

RunStepDeltaCodeInterpreterLogOutput

Represents a log output as produced by the Code Interpreter tool and as represented in a streaming run step's delta tool calls collection.

RunStepDeltaCodeInterpreterOutput

The abstract base representation of a streaming run step tool call's Code Interpreter tool output.

RunStepDeltaCodeInterpreterToolCall

Represents a Code Interpreter tool call within a streaming run step's tool call details.

RunStepDeltaDetail

Represents a single run step detail item in a streaming run step's delta payload.

RunStepDeltaFileSearchToolCall

Represents a file search tool call within a streaming run step's tool call details.

RunStepDeltaFunction

Represents the function data in a streaming run step delta's function tool call.

RunStepDeltaFunctionToolCall

Represents a function tool call within a streaming run step's tool call details.

RunStepDeltaMessageCreation

Represents a message creation within a streaming run step delta.

RunStepDeltaMessageCreationObject

Represents the data within a streaming run step message creation response object.

RunStepDeltaToolCall

The abstract base representation of a single tool call within a streaming run step's delta tool call details.

RunStepDeltaToolCallObject

Represents an invocation of tool calls as part of a streaming run step.

RunStepDetails

An abstract representation of the details for a run step.

RunStepError

The error information associated with a failed run step.

RunStepFileSearchToolCall

A record of a call to a file search tool, issued by the model in evaluation of a defined tool, that represents executed file search.

RunStepFileSearchToolCallResult

File search tool call result.

RunStepFileSearchToolCallResults

The results of the file search.

RunStepFunctionToolCall

A record of a call to a function tool, issued by the model in evaluation of a defined tool, that represents the inputs and output consumed and emitted by the specified function.

RunStepFunctionToolCallDetails

The detailed information about the function called by the model.

RunStepMessageCreationDetails

The detailed information associated with a message creation run step.

RunStepMessageCreationReference

The details of a message created as a part of a run step.

RunStepMicrosoftFabricToolCall

A record of a call to a Microsoft Fabric tool, issued by the model in evaluation of a defined tool, that represents executed Microsoft Fabric operations.

RunStepOpenAPIToolCall

A record of a call to an OpenAPI tool, issued by the model in evaluation of a defined tool, that represents executed OpenAPI operations.

RunStepSharepointToolCall

A record of a call to a SharePoint tool, issued by the model in evaluation of a defined tool, that represents executed SharePoint actions.

RunStepToolCall

An abstract representation of a detailed tool call as recorded within a run step for an existing run.

RunStepToolCallDetails

The detailed information associated with a run step calling tools.

RunStepsGetRunStepOptionalParams

Optional parameters.

RunStepsListRunStepsOptionalParams

Optional parameters.

RunStepsOperations

Interface representing a RunSteps operations.

RunsCancelRunOptionalParams

Optional parameters.

RunsCreateRunOptionalParams

Optional parameters.

RunsGetRunOptionalParams

Optional parameters.

RunsListRunsOptionalParams

Optional parameters.

RunsOperations

Interface representing a Runs operations.

RunsSubmitToolOutputsToRunOptionalParams

Optional parameters.

RunsUpdateRunOptionalParams

Optional parameters.

SharepointToolDefinition

The input definition information for a sharepoint tool as used to configure an agent.

SubmitToolOutputsAction

The details for required tool calls that must be submitted for an agent thread run to continue.

SubmitToolOutputsDetails

The details describing tools that should be called to submit tool outputs.

ThreadDeletionStatus

The status of a thread deletion operation.

ThreadMessage

A single, existing message within an agent thread.

ThreadMessageOptions

A single message within an agent thread, as provided during that thread's creation for its initial state.

ThreadRun

Data representing a single evaluation run of an agent thread.

ThreadsCreateThreadOptionalParams

Optional parameters.

ThreadsDeleteThreadOptionalParams

Optional parameters.

ThreadsGetThreadOptionalParams

Optional parameters.

ThreadsListThreadsOptionalParams

Optional parameters.

ThreadsOperations

Interface representing a Threads operations.

ThreadsUpdateThreadOptionalParams

Optional parameters.

ToolConnection

A connection resource.

ToolConnectionList

A set of connection resources currently used by either the bing_grounding, fabric_dataagent, or sharepoint_grounding tools.

ToolDefinition

An abstract representation of an input tool definition that an agent can use.

ToolOutput

The data provided during a tool outputs submission to resolve pending tool calls and allow the model to continue.

ToolResources

A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the code_interpreter tool requires a list of file IDs, while the file_search tool requires a list of vector store IDs.

TruncationObject

Controls for how a thread will be truncated prior to the run. Use this to control the initial context window of the run.

UpdateAgentOptionalParams

Optional parameters.

UpdateCodeInterpreterToolResourceOptions

Request object to update code_interpreted tool resources.

UpdateFileSearchToolResourceOptions

Request object to update file_search tool resources.

UpdateToolResourcesOptions

Request object. A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the code_interpreter tool requires a list of file IDs, while the file_search tool requires a list of vector store IDs.

VectorStore

A vector store is a collection of processed files can be used by the file_search tool.

VectorStoreAutoChunkingStrategyRequest

The default strategy. This strategy currently uses a max_chunk_size_tokens of 800 and chunk_overlap_tokens of 400.

VectorStoreAutoChunkingStrategyResponse

This is returned when the chunking strategy is unknown. Typically, this is because the file was indexed before the chunking_strategy concept was introduced in the API.

VectorStoreChunkingStrategyRequest

An abstract representation of a vector store chunking strategy configuration.

VectorStoreChunkingStrategyResponse

An abstract representation of a vector store chunking strategy configuration.

VectorStoreConfiguration

Vector storage configuration is the list of data sources, used when multiple files can be used for the enterprise file search.

VectorStoreConfigurations

The structure, containing the list of vector storage configurations i.e. the list of azure asset IDs.

VectorStoreDataSource

The structure, containing Azure asset URI path and the asset type of the file used as a data source for the enterprise file search.

VectorStoreDeletionStatus

Response object for deleting a vector store.

VectorStoreExpirationPolicy

The expiration policy for a vector store.

VectorStoreFile

Description of a file attached to a vector store.

VectorStoreFileBatch

A batch of files attached to a vector store.

VectorStoreFileBatchesCancelVectorStoreFileBatchOptionalParams

Optional parameters.

VectorStoreFileBatchesCreateVectorStoreFileBatchOptionalParams

Optional parameters.

VectorStoreFileBatchesGetVectorStoreFileBatchOptionalParams

Optional parameters.

VectorStoreFileBatchesListVectorStoreFileBatchFilesOptionalParams

Optional parameters.

VectorStoreFileBatchesOperations

Interface representing a VectorStoreFileBatches operations.

VectorStoreFileCount

Counts of files processed or being processed by this vector store grouped by status.

VectorStoreFileDeletionStatus

Response object for deleting a vector store file relationship.

VectorStoreFileError

Details on the error that may have occurred while processing a file for this vector store

VectorStoreFilesCreateVectorStoreFileOptionalParams

Optional parameters.

VectorStoreFilesDeleteVectorStoreFileOptionalParams

Optional parameters.

VectorStoreFilesGetVectorStoreFileOptionalParams

Optional parameters.

VectorStoreFilesListVectorStoreFilesOptionalParams

Optional parameters.

VectorStoreFilesOperations

Interface representing a VectorStoreFiles operations.

VectorStoreStaticChunkingStrategyOptions

Options to configure a vector store static chunking strategy.

VectorStoreStaticChunkingStrategyRequest

A statically configured chunking strategy.

VectorStoreStaticChunkingStrategyResponse

A statically configured chunking strategy.

VectorStoresCreateVectorStoreOptionalParams

Optional parameters.

VectorStoresDeleteVectorStoreOptionalParams

Optional parameters.

VectorStoresGetVectorStoreOptionalParams

Optional parameters.

VectorStoresListVectorStoresOptionalParams

Optional parameters.

VectorStoresModifyVectorStoreOptionalParams

Optional parameters.

VectorStoresOperations

Interface representing a VectorStores operations.

Type Aliases

AgentEventStreamData

Represents a stream event data in the agent.

AgentRunResponse

Agent run response with support to stream.

AgentStreamEvent

Alias for AgentStreamEvent

AgentsNamedToolChoiceType

Available tool types for agents named tools.

AgentsResponseFormatMode

Represents the mode in which the model will handle the return format of a tool call.

AgentsResponseFormatOption

Alias for AgentsResponseFormatOption

AgentsToolChoiceOption

Alias for AgentsToolChoiceOption

AgentsToolChoiceOptionMode

Specifies how the tool choice will be used

AzureAISearchQueryType

Available query types for Azure AI Search tool.

ContinuablePage

An interface that describes a page of results.

FileContents

Valid values for the contents of a binary file.

FilePurpose

The possible values denoting the intended usage of a file.

FileState

The state of the file.

ImageDetailLevel

Specifies an image's detail level. Can be 'auto', 'low', 'high', or an unknown future value.

IncompleteDetailsReason

The reason why the run is incomplete. This will point to which specific token limit was reached over the course of the run.

ListSortOrder

The available sorting options when requesting a list of response objects.

MessageAttachmentToolDefinition

Alias for MessageAttachmentToolDefinition

MessageBlockType

Specifies the kind of content block within a message. Could be text, an image file, an external image URL, or an unknown future type.

MessageContentUnion

Alias for MessageContentUnion

MessageDeltaContentUnion

Alias for MessageDeltaContentUnion

MessageDeltaTextAnnotationUnion

Alias for MessageDeltaTextAnnotationUnion

MessageIncompleteDetailsReason

A set of reasons describing why a message is marked as incomplete.

MessageInputContent

Alias for MessageInputContent

MessageInputContentBlockUnion

Alias for MessageInputContentBlockUnion

MessageRole

The possible values for roles attributed to messages in a thread.

MessageStatus

The possible execution status values for a thread message.

MessageTextAnnotationUnion

Alias for MessageTextAnnotationUnion

OpenApiAuthDetailsUnion

Alias for OpenApiAuthDetailsUnion

OpenApiAuthType

Authentication type for OpenApi endpoint. Allowed types are:

  • Anonymous (no authentication required)
  • Connection (requires connection_id to endpoint, as setup in AI Foundry)
  • Managed_Identity (requires audience for identity based auth)
RequiredActionUnion

Alias for RequiredActionUnion

RequiredToolCallUnion

Alias for RequiredToolCallUnion

ResponseFormat

Possible API response formats.

RunAdditionalFieldList

A list of additional fields to include in the response.

RunStatus

Possible values for the status of an agent thread run.

RunStepCodeInterpreterToolCallOutputUnion

Alias for RunStepCodeInterpreterToolCallOutputUnion

RunStepDeltaCodeInterpreterOutputUnion

Alias for RunStepDeltaCodeInterpreterOutputUnion

RunStepDeltaDetailUnion

Alias for RunStepDeltaDetailUnion

RunStepDeltaToolCallUnion

Alias for RunStepDeltaToolCallUnion

RunStepDetailsUnion

Alias for RunStepDetailsUnion

RunStepErrorCode

Possible error code values attributable to a failed run step.

RunStepStatus

Possible values for the status of a run step.

RunStepToolCallUnion

Alias for RunStepToolCallUnion

RunStepType

The possible types of run steps.

ToolDefinitionUnion

Alias for ToolDefinitionUnion

TruncationStrategy

Possible truncation strategies for the thread.

VectorStoreChunkingStrategyRequestType

Type of chunking strategy

VectorStoreChunkingStrategyRequestUnion

Alias for VectorStoreChunkingStrategyRequestUnion

VectorStoreChunkingStrategyResponseType

Type of chunking strategy

VectorStoreChunkingStrategyResponseUnion

Alias for VectorStoreChunkingStrategyResponseUnion

VectorStoreExpirationPolicyAnchor

Describes the relationship between the days and the expiration of this vector store

VectorStoreFileBatchStatus

The status of the vector store file batch.

VectorStoreFileErrorCode

Error code variants for vector store file processing

VectorStoreFileStatus

Vector store file status

VectorStoreFileStatusFilter

Query parameter filter for vector store file retrieval endpoint

VectorStoreStatus

Vector store possible status

Enums

DoneEvent

Terminal event indicating the successful end of a stream.

ErrorEvent

Terminal event indicating a server side error while streaming.

KnownVersions

Azure AI Agents API versions

MessageStreamEvent

Message operation related streaming events

RunStepStreamEvent

Run step operation related streaming events

RunStreamEvent

Run operation related streaming events

ThreadStreamEvent

Thread operation related streaming events

VectorStoreDataSourceAssetType

Type of vector storage asset. Asset type may be a uri_asset, in this case it should contain asset URI ID, in the case of id_asset it should contain the data ID.

connectionToolType

Types of connection tools used to configure an agent

Functions

isOutputOfType<T>(ToolDefinitionUnion | RequiredAction | RequiredToolCall, string)

Determines if the given output is of the specified type.

Function Details

isOutputOfType<T>(ToolDefinitionUnion | RequiredAction | RequiredToolCall, string)

Determines if the given output is of the specified type.

function isOutputOfType<T>(output: ToolDefinitionUnion | RequiredAction | RequiredToolCall, type: string): output

Parameters

output

ToolDefinitionUnion | RequiredAction | RequiredToolCall

The action to check, which can be of type RequiredAction, RequiredToolCall, or ToolDefinitionUnion.

type

string

The type to check the action against.

Returns

output

A boolean indicating whether the action is of the specified type.