Airflow Summit 2026 is coming August 31 - September 2 in Austin, TX. Register now to secure your spot!

airflow.providers.microsoft.azure.hooks.ai_agents

Attributes

DEFAULT_REQUEST_TIMEOUT

Classes

AzureAIAgentsHook

Hook for Microsoft Foundry Hosted agents, backed by the azure-ai-projects SDK.

AzureAIAgentsAsyncHook

Async hook for Microsoft Foundry Hosted agents.

Module Contents

airflow.providers.microsoft.azure.hooks.ai_agents.DEFAULT_REQUEST_TIMEOUT = 60.0[source]
class airflow.providers.microsoft.azure.hooks.ai_agents.AzureAIAgentsHook(azure_ai_agents_conn_id=default_conn_name, endpoint=None, api_version='v1', timeout=DEFAULT_REQUEST_TIMEOUT)[source]

Bases: airflow.providers.common.compat.sdk.BaseHook

Hook for Microsoft Foundry Hosted agents, backed by the azure-ai-projects SDK.

Wraps the Agents operations of azure.ai.projects.AIProjectClient: https://learn.microsoft.com/en-us/azure/foundry/agents/how-to/deploy-hosted-agent

Parameters:
  • azure_ai_agents_conn_id (str) – The Azure AI Agents connection id. Default is azure_ai_agents_default.

  • endpoint (str | None) – Optional Azure AI Foundry project endpoint. If not provided, the hook uses the connection host or the endpoint connection extra. Default is None.

  • api_version (str) – Foundry Agent Service API version. Default is v1.

  • timeout (float | None) – Optional connection/read timeout for service requests, in seconds. Default is 60.0.

conn_name_attr = 'azure_ai_agents_conn_id'[source]
default_conn_name = 'azure_ai_agents_default'[source]
conn_type = 'azure_ai_agents'[source]
hook_name = 'Azure AI Foundry Hosted Agents'[source]
conn_id = 'azure_ai_agents_default'[source]
endpoint = None[source]
api_version = 'v1'[source]
timeout = 60.0[source]
classmethod get_connection_form_widgets()[source]

Return connection widgets to add to connection form.

classmethod get_ui_field_behaviour()[source]

Return custom field behaviour.

get_conn()[source]

Return the Azure AI Foundry project client.

create_agent_version(agent_name, definition, *, metadata=None, description=None, blueprint_reference=None)[source]

Create a Hosted agent version, creating the Hosted agent itself on first use.

Parameters:
  • agent_name (str) – Hosted agent name.

  • definition (dict[str, Any] | azure.ai.projects.models.AgentDefinition) – Hosted agent container definition.

  • metadata (dict[str, str] | None) – Optional metadata attached to the Hosted agent. Default is None.

  • description (str | None) – Optional human-readable Hosted agent description. Default is None.

  • blueprint_reference (azure.ai.projects.models.AgentBlueprintReference | None) – Optional managed identity blueprint reference. Default is None.

Returns:

Created Hosted agent version.

Return type:

azure.ai.projects.models.AgentVersionDetails

get_agent_version(agent_name, agent_version)[source]

Get a Hosted agent version.

Parameters:
  • agent_name (str) – Hosted agent name.

  • agent_version (str) – Hosted agent version.

Returns:

Hosted agent version details.

Return type:

azure.ai.projects.models.AgentVersionDetails

get_agent(agent_name)[source]

Get a Hosted agent.

Parameters:

agent_name (str) – Hosted agent name.

Returns:

Hosted agent details.

Return type:

azure.ai.projects.models.AgentDetails

delete_agent(agent_name, *, force=False)[source]

Delete a Hosted agent and all versions.

Parameters:
  • agent_name (str) – Hosted agent name.

  • force (bool) – Whether to force deletion when the Hosted agent has active sessions. Default is False.

Returns:

Deletion response.

Return type:

azure.ai.projects.models.DeleteAgentResponse

delete_agent_version(agent_name, agent_version, *, force=False)[source]

Delete one Hosted agent version.

Parameters:
  • agent_name (str) – Hosted agent name.

  • agent_version (str) – Hosted agent version.

  • force (bool) – Whether to force deletion when the Hosted agent version has active sessions. Default is False.

Returns:

Deletion response.

Return type:

azure.ai.projects.models.DeleteAgentVersionResponse

is_agent_version_deleted(agent_name, agent_version)[source]

Return True if the Hosted agent version no longer exists or is deleted.

Parameters:
  • agent_name (str) – Hosted agent name.

  • agent_version (str) – Hosted agent version.

Returns:

True when the Hosted agent version no longer exists or has deleted status.

Return type:

bool

is_agent_deleted(agent_name)[source]

Return True if the Hosted agent no longer exists.

Parameters:

agent_name (str) – Hosted agent name.

Returns:

True when the Hosted agent no longer exists.

Return type:

bool

invoke_agent_responses(agent_name, input_data, *, user_isolation_key=None)[source]

Invoke a Hosted agent through the OpenAI Responses protocol.

Parameters:
  • agent_name (str) – Hosted agent name.

  • input_data (dict[str, Any]) – Request payload for the Responses protocol.

  • user_isolation_key (str | None) – Optional user isolation key for endpoint resources. Default is None.

Returns:

JSON-compatible Responses protocol response.

Return type:

dict[str, pydantic.JsonValue]

invoke_agent_invocations(agent_name, input_data, *, agent_session_id=None, user_isolation_key=None)[source]

Invoke a Hosted agent through the Invocations protocol.

The SDK does not expose the Invocations protocol yet, so the request is sent through the project client pipeline, which handles authentication and preview feature headers.

Parameters:
  • agent_name (str) – Hosted agent name.

  • input_data (dict[str, Any]) – Request payload for the Invocations protocol.

  • agent_session_id (str | None) – Optional Hosted agent session id. Default is None.

  • user_isolation_key (str | None) – Optional user isolation key for endpoint resources. Default is None.

Returns:

JSON-compatible Invocations protocol payload; its shape is defined by the Hosted agent container.

Return type:

pydantic.JsonValue

class airflow.providers.microsoft.azure.hooks.ai_agents.AzureAIAgentsAsyncHook(azure_ai_agents_conn_id=AzureAIAgentsHook.default_conn_name, endpoint=None, api_version='v1', timeout=DEFAULT_REQUEST_TIMEOUT)[source]

Bases: AzureAIAgentsHook

Async hook for Microsoft Foundry Hosted agents.

Parameters:
  • azure_ai_agents_conn_id (str) – The Azure AI Agents connection id. Default is azure_ai_agents_default.

  • endpoint (str | None) – Optional Azure AI Foundry project endpoint override. Default is None.

  • api_version (str) – Foundry Agent Service API version. Default is v1.

  • timeout (float | None) – Optional connection/read timeout for service requests, in seconds. Default is 60.0.

async close()[source]

Close the async Azure AI Foundry project client and credential.

async get_async_conn()[source]

Return the async Azure AI Foundry project client.

async async_get_agent_version(agent_name, agent_version)[source]

Get a Hosted agent version asynchronously.

Parameters:
  • agent_name (str) – Hosted agent name.

  • agent_version (str) – Hosted agent version.

Returns:

Hosted agent version details.

Return type:

azure.ai.projects.models.AgentVersionDetails

Was this entry helpful?