Skip to content

Commit 23c2865

Browse files
committed
refactor: remove inherited 'get_all_tools' method from Agent class
1 parent 2b0485b commit 23c2865

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

src/agents/agent.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -289,23 +289,3 @@ async def get_prompt(
289289
) -> ResponsePromptParam | None:
290290
"""Get the prompt for the agent."""
291291
return await PromptUtil.to_model_input(self.prompt, run_context, self)
292-
293-
async def get_all_tools(self, run_context: RunContextWrapper[Any]) -> list[Tool]:
294-
"""All agent tools, including MCP tools and function tools."""
295-
mcp_tools = await self.get_mcp_tools(run_context)
296-
297-
async def _check_tool_enabled(tool: Tool) -> bool:
298-
if not isinstance(tool, FunctionTool):
299-
return True
300-
301-
attr = tool.is_enabled
302-
if isinstance(attr, bool):
303-
return attr
304-
res = attr(run_context, self)
305-
if inspect.isawaitable(res):
306-
return bool(await res)
307-
return bool(res)
308-
309-
results = await asyncio.gather(*(_check_tool_enabled(t) for t in self.tools))
310-
enabled: list[Tool] = [t for t, ok in zip(self.tools, results) if ok]
311-
return [*mcp_tools, *enabled]

0 commit comments

Comments
 (0)