Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
37303b0
remove unused code in af
JC-386 Jan 19, 2026
f0e4630
created subclasses for agent-framework AIAgent and WorkflowAgent
lusu-msft Jan 20, 2026
2196a81
remove unused code
lusu-msft Jan 20, 2026
4ae465b
validate core with tox
JC-386 Jan 20, 2026
06f568e
refining agent framework adapters
lusu-msft Jan 20, 2026
2a94c40
refining adapters
lusu-msft Jan 20, 2026
18acd9f
updated minors
lusu-msft Jan 20, 2026
0f2b742
Merge branch 'jc/fix-linters-for-tools' into lusu/af-checkpoint-0119
lusu-msft Jan 20, 2026
8fde0d9
update from_agent_framework
lusu-msft Jan 21, 2026
0dca736
resolve trailing whitespace
lusu-msft Jan 21, 2026
bd1b95e
fix samples
lusu-msft Jan 21, 2026
47bfb31
resolve unused import and long lines
lusu-msft Jan 21, 2026
fcd73b9
fixed pylint
lusu-msft Jan 21, 2026
93bde67
Merge branch 'lusu/agentserver-1110' into lusu/af-checkpoint-0119
lusu-msft Jan 21, 2026
009f145
fix unittest in langgraph
lusu-msft Jan 21, 2026
4bbb480
Merge branch 'lusu/af-checkpoint-0119' into lusu/af-build-0121
lusu-msft Jan 21, 2026
8db2c1a
fix sphinx for core
lusu-msft Jan 22, 2026
7a0f6cb
Merge branch 'lusu/agentserver-1110' into lusu/af-build-0121
lusu-msft Jan 22, 2026
4a02765
fix minors
lusu-msft Jan 22, 2026
a58b6a5
fix pylint
lusu-msft Jan 22, 2026
2e40950
tools ut in core package
JC-386 Jan 22, 2026
ed539e5
add cachetools min version
lusu-msft Jan 22, 2026
1a031f3
fix bugs for non stream converter
lusu-msft Jan 22, 2026
c68ee16
fix pylint
lusu-msft Jan 22, 2026
7a1324e
add output type check
lusu-msft Jan 22, 2026
7adbb66
fix minors
lusu-msft Jan 23, 2026
61e8c4c
updated version and changelog
lusu-msft Jan 23, 2026
b8a543a
update required core package
lusu-msft Jan 23, 2026
41b9b53
fix langgraph sphinx
lusu-msft Jan 23, 2026
4ce7714
Merge remote-tracking branch 'origin/lusu/af-build-0121' into jc/tool…
JC-386 Jan 23, 2026
f192f0b
Put LG run context to runtime & config
JC-386 Jan 23, 2026
2986496
langgraph ut
JC-386 Jan 23, 2026
bd8da8e
optimize af code
JC-386 Jan 23, 2026
2f2ca63
add more uts. support resource id format of project connection id
JC-386 Jan 23, 2026
eb7cdd5
Merge branch 'lusu/agentserver-1110' into jc/tools-uts
JC-386 Jan 23, 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
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

from azure.ai.agentserver.core import AgentServerContext
from azure.ai.agentserver.core.logger import get_logger
from azure.ai.agentserver.core.tools import FoundryToolLike, ResolvedFoundryTool
from azure.ai.agentserver.core.tools import FoundryToolLike, ResolvedFoundryTool, ensure_foundry_tool

logger = get_logger()

Expand Down Expand Up @@ -45,7 +45,7 @@ def __init__(
self,
tools: Sequence[FoundryToolLike],
) -> None:
self._allowed_tools: List[FoundryToolLike] = list(tools)
self._allowed_tools: List[FoundryToolLike] = [ensure_foundry_tool(tool) for tool in tools]

async def list_tools(self) -> List[AIFunction]:
server_context = AgentServerContext.get()
Expand All @@ -71,7 +71,7 @@ def _to_aifunction(self, foundry_tool: "ResolvedFoundryTool") -> AIFunction:
# Build field definitions for the Pydantic model
field_definitions: Dict[str, Any] = {}
for field_name, field_info in properties.items():
field_type = self._json_schema_type_to_python(field_info.type or "string")
field_type = field_info.type.py_type
field_description = field_info.description or ""
is_required = field_name in required_fields

Expand Down Expand Up @@ -107,24 +107,6 @@ async def tool_func(**kwargs: Any) -> Any:
input_model=input_model
)

def _json_schema_type_to_python(self, json_type: str) -> type:
"""Convert JSON schema type to Python type.

:param json_type: The JSON schema type string.
:type json_type: str
:return: The corresponding Python type.
:rtype: type
"""
type_map = {
"string": str,
"number": float,
"integer": int,
"boolean": bool,
"array": list,
"object": dict,
}
return type_map.get(json_type, str)


class FoundryToolsChatMiddleware(ChatMiddleware):
"""Chat middleware to inject Foundry tools into ChatOptions on each call."""
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------

__path__ = __import__('pkgutil').extend_path(__path__, __name__)
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
FoundryConnectedTool,
FoundryHostedMcpTool,
FoundryTool,
FoundryToolDetails,
FoundryToolProtocol,
FoundryToolSource,
ResolvedFoundryTool,
Expand Down Expand Up @@ -47,6 +48,7 @@
"FoundryConnectedTool",
"FoundryHostedMcpTool",
"FoundryTool",
"FoundryToolDetails",
"FoundryToolProtocol",
"FoundryToolSource",
"ResolvedFoundryTool",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import re
from typing import Any, Dict, Union

from .. import FoundryConnectedTool, FoundryHostedMcpTool
Expand Down Expand Up @@ -45,6 +46,48 @@ def ensure_foundry_tool(tool: FoundryToolLike) -> FoundryTool:
if not isinstance(project_connection_id, str) or not project_connection_id:
raise InvalidToolFacadeError(f"project_connection_id is required for tool protocol {protocol}.")

return FoundryConnectedTool(protocol=protocol, project_connection_id=project_connection_id)
# Parse the connection identifier to extract the connection name
connection_name = _parse_connection_id(project_connection_id)
return FoundryConnectedTool(protocol=protocol, project_connection_id=connection_name)
except ValueError:
return FoundryHostedMcpTool(name=tool_type, configuration=tool)


# Pattern for Azure resource ID format:
# /subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.CognitiveServices/accounts/<account>/projects/<project>/connections/<name>
_RESOURCE_ID_PATTERN = re.compile(
r"^/subscriptions/[^/]+/resourceGroups/[^/]+/providers/Microsoft\.CognitiveServices/"
r"accounts/[^/]+/projects/[^/]+/connections/(?P<name>[^/]+)$",
re.IGNORECASE,
)


def _parse_connection_id(connection_id: str) -> str:
"""Parse the connection identifier and extract the connection name.

Supports two formats:
1. Simple name: "my-connection-name"
2. Resource ID: "/subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.CognitiveServices/accounts/<account>/projects/<project>/connections/<name>"

:param connection_id: The connection identifier, either a simple name or a full resource ID.
:type connection_id: str
:return: The connection name extracted from the identifier.
:rtype: str
:raises InvalidToolFacadeError: If the connection_id format is invalid.
"""
if not connection_id:
raise InvalidToolFacadeError("Connection identifier cannot be empty.")

# Check if it's a resource ID format (starts with /)
if connection_id.startswith("/"):
match = _RESOURCE_ID_PATTERN.match(connection_id)
if not match:
raise InvalidToolFacadeError(
f"Invalid resource ID format for connection: '{connection_id}'. "
"Expected format: /subscriptions/<sub>/resourceGroups/<rg>/providers/"
"Microsoft.CognitiveServices/accounts/<account>/projects/<project>/connections/<name>"
)
return match.group("name")

# Otherwise, treat it as a simple connection name
return connection_id
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------

__path__ = __import__('pkgutil').extend_path(__path__, __name__)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------

__path__ = __import__('pkgutil').extend_path(__path__, __name__)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------

Loading