fix: skip ADK toolsets in AgentConfig tool declaration extraction#6862
Closed
ks-hj wants to merge 1 commit into
Closed
fix: skip ADK toolsets in AgentConfig tool declaration extraction#6862ks-hj wants to merge 1 commit into
ks-hj wants to merge 1 commit into
Conversation
ADK toolsets (e.g. McpToolset, OpenAPIToolset) expose their tools only asynchronously via get_tools() and have no _get_declaration(); the plain-callable fallback called inspect.signature() on the toolset instance and raised TypeError, making any MCP-tooled ADK agent fail client-side eval inference (AgentConfig.from_agent). Skip toolsets in the extraction loop in both SDK copies; their tool declarations cannot be resolved synchronously. Fixes googleapis#6861
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Author
|
Withdrawn. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6861
AgentConfig._get_tool_declarations_from_agentraisesTypeErrorfor any ADK agent whosetoolsinclude a toolset (BaseToolset— e.g.McpToolset,OpenAPIToolset): toolsets have no_get_declaration()and are not plain callables, so they fall through toFunctionDeclaration.from_callable_with_api_option→inspect.signature()→TypeError: <McpToolset object ...> is not a callable object. This breaks client-side eval inference (client.evals.run_inference) for every MCP-tooled ADK agent.This change skips toolsets in the extraction loop (detected by their
get_tools()interface), in both SDK copies —vertexai/_genai/types/evals.pyandagentplatform/_genai/types/evals.py— mirroring the existing skip for declaration-less ADK tools. Toolset tool declarations cannot be resolved synchronously (async + context-dependent), and the declarations here are descriptive agent metadata.Testing
TestAgentConfigToolDeclarations::test_skips_toolsets_without_declaration(regression: fake toolset no longer raises; declaration-bearing tool and plain callable still extracted).pytest tests/unit/agentplatform/genai/test_evals.py -k "Transformers or DropEmptyColumns or AgentConfig"→ 10 passed.McpToolset(previously failed with the exact traceback in the issue; with this patch, inference runs and tool calls execute normally).