Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
e03f6ac
Added get_agent method to Azure AI V2
dmytrostruk Dec 31, 2025
7829927
Small fixes
dmytrostruk Dec 31, 2025
235b31d
Small fix
dmytrostruk Dec 31, 2025
2d14930
Merge branch 'main' into create-agent-api
dmytrostruk Jan 5, 2026
6b11a9e
Removed AzureAIAgentProvider
dmytrostruk Jan 5, 2026
7e81902
Added create_agent method
dmytrostruk Jan 6, 2026
0fbbcff
Merge branch 'main' into create-agent-api
dmytrostruk Jan 6, 2026
48d3bbf
Small fixes
dmytrostruk Jan 6, 2026
0757539
Fixed code interpreter tool mapping
dmytrostruk Jan 6, 2026
a08c5d2
Merge branch 'main' into create-agent-api
dmytrostruk Jan 6, 2026
6c6db3f
Merge branch 'main' into create-agent-api
dmytrostruk Jan 6, 2026
72b27d2
Merge branch 'main' into create-agent-api
dmytrostruk Jan 7, 2026
4620000
Merge branch 'main' into create-agent-api
dmytrostruk Jan 12, 2026
348a94d
Added agent provider for V2 client
dmytrostruk Jan 12, 2026
e55a10d
Updated response format handling
dmytrostruk Jan 12, 2026
0accc46
Added provider example
dmytrostruk Jan 13, 2026
3b74ffb
Merge branch 'main' into create-agent-api
dmytrostruk Jan 13, 2026
470a51b
Fixed errors
dmytrostruk Jan 13, 2026
ddb9e1a
Update python/samples/getting_started/agents/azure_ai/README.md
dmytrostruk Jan 13, 2026
b852ac9
Small fix
dmytrostruk Jan 13, 2026
6121b60
Merge branch 'main' into create-agent-api
dmytrostruk Jan 13, 2026
b3bbe35
Merge branch 'main' into create-agent-api
dmytrostruk Jan 13, 2026
b4b7b75
Updates from merge
dmytrostruk Jan 13, 2026
1a2b3f2
Resolved comments
dmytrostruk Jan 14, 2026
1a31ca2
Merge branch 'main' into create-agent-api
dmytrostruk Jan 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions python/packages/azure-ai/agent_framework_azure_ai/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from ._chat_client import AzureAIAgentClient, AzureAIAgentOptions
from ._client import AzureAIClient
from ._provider import AzureAIProjectAgentProvider
from ._shared import AzureAISettings

try:
Expand All @@ -15,6 +16,7 @@
"AzureAIAgentClient",
"AzureAIAgentOptions",
"AzureAIClient",
"AzureAIProjectAgentProvider",
"AzureAISettings",
"__version__",
]
54 changes: 5 additions & 49 deletions python/packages/azure-ai/agent_framework_azure_ai/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import sys
from collections.abc import Mapping, MutableSequence
from typing import TYPE_CHECKING, Any, ClassVar, Generic, TypedDict, cast
from typing import TYPE_CHECKING, Any, ClassVar, Generic, TypedDict, TypeVar, cast

from agent_framework import (
AGENT_FRAMEWORK_USER_AGENT,
Expand All @@ -13,23 +13,20 @@
use_chat_middleware,
use_function_invocation,
)
from agent_framework.exceptions import ServiceInitializationError, ServiceInvalidRequestError
from agent_framework.exceptions import ServiceInitializationError
from agent_framework.observability import use_instrumentation
from agent_framework.openai._responses_client import OpenAIBaseResponsesClient
from azure.ai.projects.aio import AIProjectClient
from azure.ai.projects.models import (
MCPTool,
PromptAgentDefinition,
PromptAgentDefinitionText,
ResponseTextFormatConfigurationJsonObject,
ResponseTextFormatConfigurationJsonSchema,
ResponseTextFormatConfigurationText,
)
from azure.core.credentials_async import AsyncTokenCredential
from azure.core.exceptions import ResourceNotFoundError
from pydantic import BaseModel, ValidationError
from pydantic import ValidationError

from ._shared import AzureAISettings
from ._shared import AzureAISettings, create_text_format_config

if TYPE_CHECKING:
from agent_framework.openai import OpenAIResponsesOptions
Expand Down Expand Up @@ -286,47 +283,6 @@ async def close(self) -> None:
"""Close the project_client."""
await self._close_client_if_needed()

def _create_text_format_config(
self, response_format: type[BaseModel] | Mapping[str, Any]
) -> (
ResponseTextFormatConfigurationJsonSchema
| ResponseTextFormatConfigurationJsonObject
| ResponseTextFormatConfigurationText
):
"""Convert response_format into Azure text format configuration."""
if isinstance(response_format, type) and issubclass(response_format, BaseModel):
schema = response_format.model_json_schema()
# Ensure additionalProperties is explicitly false to satisfy Azure validation
if isinstance(schema, dict):
schema.setdefault("additionalProperties", False)
return ResponseTextFormatConfigurationJsonSchema(
name=response_format.__name__,
schema=schema,
)

if isinstance(response_format, Mapping):
format_config = self._convert_response_format(response_format)
format_type = format_config.get("type")
if format_type == "json_schema":
# Ensure schema includes additionalProperties=False to satisfy Azure validation
schema = dict(format_config.get("schema", {})) # type: ignore[assignment]
schema.setdefault("additionalProperties", False)
config_kwargs: dict[str, Any] = {
"name": format_config.get("name") or "response",
"schema": schema,
}
if "strict" in format_config:
config_kwargs["strict"] = format_config["strict"]
if "description" in format_config:
config_kwargs["description"] = format_config["description"]
return ResponseTextFormatConfigurationJsonSchema(**config_kwargs)
if format_type == "json_object":
return ResponseTextFormatConfigurationJsonObject()
if format_type == "text":
return ResponseTextFormatConfigurationText()

raise ServiceInvalidRequestError("response_format must be a Pydantic model or mapping.")

async def _get_agent_reference_or_create(
self,
run_options: dict[str, Any],
Expand Down Expand Up @@ -380,7 +336,7 @@ async def _get_agent_reference_or_create(
# response_format is accessed from chat_options or additional_properties
# since the base class excludes it from run_options
if chat_options and (response_format := chat_options.get("response_format")):
args["text"] = PromptAgentDefinitionText(format=self._create_text_format_config(response_format))
args["text"] = PromptAgentDefinitionText(format=create_text_format_config(response_format))

# Combine instructions from messages and options
combined_instructions = [
Expand Down
Loading
Loading