Share via


AzureResponsesAgent Class

Azure Responses Agent class, extending OpenAIResponsesAgent to provide specialized agent interaction for Azure-based Responses deployments.

Constructor

OpenAIResponsesAgent( *, ai_model_id: str, client: AsyncOpenAI, arguments: KernelArguments | None = None, description: str | None = None, function_choice_behavior: FunctionChoiceBehavior | None = None, id: str | None = None, instruction_role: str | None = None, instructions: str | None = None, kernel: Kernel | None = None, metadata: dict[str, str] | None = None, name: str | None = None, plugins: list[KernelPlugin | object] | dict[str, KernelPlugin | object] | None = None, polling_options: RunPollingOptions | None = None, prompt_template_config: PromptTemplateConfig | None = None, store_enabled: bool | None = None, temperature: float | None = None, text: ResponseTextConfigParam | None = None, tools: list[ToolParam] | None = None, top_p: float | None = None, **kwargs: Any )

Keyword-Only Parameters

Name Description
ai_model_id
Required

The AI model ID to use for "Responses" calls.

client
Required

The openai.AsyncOpenAI client.

arguments

Optional KernelArguments for custom behavior or prompt overrides.

description

Agent description.

function_choice_behavior

Configuration for function selection / plugin usage.

id

The unique ID for this agent instance.

instruction_role

The role used for the instructions block (system or developer).

instructions

Plain instructions for the agent. Overridden by prompt_template_config if present.

kernel

The Kernel instance, if any, used for plugin management or function calls.

metadata

Optional additional metadata for the agent.

name

Name of the agent instance.

plugins

A list or dict of KernelPlugins to attach to the agent or its kernel.

polling_options

Options controlling how the agent polls for completions / tool calls.

prompt_template_config

A prompt template config object, can override instructions if set.

store_enabled

Whether to store conversation states in the service or use ephemeral mode.

temperature

The model temperature controlling random sampling.

text

The response text config dict or object.

tools

A list of tool definitions for extended functionalities.

top_p

Alternative nucleus sampling parameter for controlling token distribution.

kwargs

Additional advanced configuration keyword arguments.

Methods

setup_resources

Create and configure an Azure OpenAI client plus the deployment name for specialized "Responses" completions, pulling from environment vars or provided arguments.

setup_resources

Create and configure an Azure OpenAI client plus the deployment name for specialized "Responses" completions, pulling from environment vars or provided arguments.

static setup_resources(*, ad_token: str | None = None, ad_token_provider: Callable[[], str | Awaitable[str]] | None = None, api_key: str | None = None, api_version: str | None = None, base_url: str | None = None, default_headers: dict[str, str] | None = None, deployment_name: str | None = None, endpoint: str | None = None, env_file_path: str | None = None, env_file_encoding: str | None = None, token_scope: str | None = None, **kwargs: Any) -> tuple[AsyncAzureOpenAI, str]

Parameters

Name Description
ad_token

A Microsoft Entra token (string-based).

ad_token_provider

A callback returning or awaiting an Entra token string.

api_key

The Azure OpenAI API key.

api_version

The Azure OpenAI API version to use.

base_url

The base URL.

default_headers

Default headers to attach to every request.

deployment_name

Name of the specialized "Responses" deployment.

endpoint

The Azure OpenAI endpoint.

env_file_path

The path of an .env file for environment variables.

env_file_encoding

The encoding for the .env file, defaults to utf-8.

token_scope

Token scope if using Entra authentication.

kwargs

Additional advanced keyword args for the client.

Returns

Type Description

A tuple (AsyncAzureOpenAI, model_name) with the client and the associated deployment name.

Attributes

is_experimental

is_experimental = True

stage_status

stage_status = 'experimental'