From c7430e60a3f8b9dec0f9cb963011e3ddc7d86e19 Mon Sep 17 00:00:00 2001 From: Giles Odigwe Date: Wed, 11 Feb 2026 13:44:52 -0800 Subject: [PATCH] Changes tools parameter type hints --- .../packages/core/agent_framework/_agents.py | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/python/packages/core/agent_framework/_agents.py b/python/packages/core/agent_framework/_agents.py index b7d8a739d5..3d4bc8de5e 100644 --- a/python/packages/core/agent_framework/_agents.py +++ b/python/packages/core/agent_framework/_agents.py @@ -616,9 +616,9 @@ def __init__( description: str | None = None, tools: FunctionTool | Callable[..., Any] - | MutableMapping[str, Any] + | Mapping[str, Any] | Any - | Sequence[FunctionTool | Callable[..., Any] | MutableMapping[str, Any] | Any] + | Sequence[FunctionTool | Callable[..., Any] | Mapping[str, Any] | Any] | None = None, default_options: OptionsCoT | None = None, chat_message_store_factory: Callable[[], ChatMessageStoreProtocol] | None = None, @@ -683,8 +683,8 @@ def __init__( tools_ = cast( FunctionTool | Callable[..., Any] - | MutableMapping[str, Any] - | list[FunctionTool | Callable[..., Any] | MutableMapping[str, Any]] + | Mapping[str, Any] + | list[FunctionTool | Callable[..., Any] | Mapping[str, Any]] | None, tools_, ) @@ -694,7 +694,7 @@ def __init__( # We ignore the MCP Servers here and store them separately, # we add their functions to the tools list at runtime - normalized_tools: list[FunctionTool | Callable[..., Any] | MutableMapping[str, Any]] = ( # type:ignore[reportUnknownVariableType] + normalized_tools: list[FunctionTool | Callable[..., Any] | Mapping[str, Any]] = ( # type:ignore[reportUnknownVariableType] [] if tools_ is None else tools_ if isinstance(tools_, list) else [tools_] # type: ignore[list-item] ) self.mcp_tools: list[MCPTool] = [tool for tool in normalized_tools if isinstance(tool, MCPTool)] # type: ignore[misc] @@ -782,9 +782,9 @@ def run( thread: AgentThread | None = None, tools: FunctionTool | Callable[..., Any] - | MutableMapping[str, Any] + | Mapping[str, Any] | Any - | list[FunctionTool | Callable[..., Any] | MutableMapping[str, Any] | Any] + | list[FunctionTool | Callable[..., Any] | Mapping[str, Any] | Any] | None = None, options: ChatOptions[ResponseModelBoundT], **kwargs: Any, @@ -799,9 +799,9 @@ def run( thread: AgentThread | None = None, tools: FunctionTool | Callable[..., Any] - | MutableMapping[str, Any] + | Mapping[str, Any] | Any - | list[FunctionTool | Callable[..., Any] | MutableMapping[str, Any] | Any] + | list[FunctionTool | Callable[..., Any] | Mapping[str, Any] | Any] | None = None, options: OptionsCoT | ChatOptions[None] | None = None, **kwargs: Any, @@ -816,9 +816,9 @@ def run( thread: AgentThread | None = None, tools: FunctionTool | Callable[..., Any] - | MutableMapping[str, Any] + | Mapping[str, Any] | Any - | list[FunctionTool | Callable[..., Any] | MutableMapping[str, Any] | Any] + | list[FunctionTool | Callable[..., Any] | Mapping[str, Any] | Any] | None = None, options: OptionsCoT | ChatOptions[Any] | None = None, **kwargs: Any, @@ -832,9 +832,9 @@ def run( thread: AgentThread | None = None, tools: FunctionTool | Callable[..., Any] - | MutableMapping[str, Any] + | Mapping[str, Any] | Any - | list[FunctionTool | Callable[..., Any] | MutableMapping[str, Any] | Any] + | list[FunctionTool | Callable[..., Any] | Mapping[str, Any] | Any] | None = None, options: OptionsCoT | ChatOptions[Any] | None = None, **kwargs: Any, @@ -987,9 +987,9 @@ async def _prepare_run_context( thread: AgentThread | None, tools: FunctionTool | Callable[..., Any] - | MutableMapping[str, Any] + | Mapping[str, Any] | Any - | list[FunctionTool | Callable[..., Any] | MutableMapping[str, Any] | Any] + | list[FunctionTool | Callable[..., Any] | Mapping[str, Any] | Any] | None, options: Mapping[str, Any] | None, kwargs: dict[str, Any], @@ -1005,7 +1005,7 @@ async def _prepare_run_context( ) # Normalize tools - normalized_tools: list[FunctionTool | Callable[..., Any] | MutableMapping[str, Any] | Any] = ( + normalized_tools: list[FunctionTool | Callable[..., Any] | Mapping[str, Any] | Any] = ( [] if tools_ is None else tools_ if isinstance(tools_, list) else [tools_] ) agent_name = self._get_agent_name() @@ -1399,9 +1399,9 @@ def __init__( description: str | None = None, tools: FunctionTool | Callable[..., Any] - | MutableMapping[str, Any] + | Mapping[str, Any] | Any - | Sequence[FunctionTool | Callable[..., Any] | MutableMapping[str, Any] | Any] + | Sequence[FunctionTool | Callable[..., Any] | Mapping[str, Any] | Any] | None = None, default_options: OptionsCoT | None = None, chat_message_store_factory: Callable[[], ChatMessageStoreProtocol] | None = None,