8000 after_tool_callback not triggering for VertexAiSearchTool in Google ADK · Issue #1121 · google/adk-python · GitHub
[go: up one dir, main page]

Skip to content
after_tool_callback not triggering for VertexAiSearchTool in Google ADK #1121
Open
@darkmars27

Description

@darkmars27

** Please make sure you read the contribution guide and file the issues in the right place. **
Contribution guide.

Describe the bug
The after_tool_callback function configured for an LlmAgent does not trigger when the agent utilizes a VertexAiSearchTool. This prevents custom logic from being executed post-tool usage.

To Reproduce
Steps to reproduce the behavior:

  • Install the Google ADK and necessary dependencies.
  • Configure a VertexAiSearchTool with a valid data_store_id.
  • Initialize an LlmAgent and pass the VertexAiSearchTool in its tools list.
  • Define a callback function (e.g., capture_after_tool_callback) and assign it to the after_tool_callback parameter of the LlmAgent.
  • Run a query through the LlmAgent that would typically trigger the VertexAiSearchTool.
  • Observe that the capture_after_tool_callback function is not executed.

Expected behavior
The after_tool_callback function (e.g., capture_after_tool_callback) should be triggered immediately after the VertexAiSearchTool successfully executes and returns its results. This allows for post-processing, logging, or state updates related to the tool's usage.

Screenshots
N/A (This is a functional bug, not a UI/visual bug)

Desktop (please complete the following information):

  • OS: Windows
  • Python version(python -V): 3.11
  • ADK version(pip show google-adk): Github Current Main version

Additional context
sample tool
def capture_after_tool_callback(
tool: BaseTool, args: Dict[str, Any], tool_context: ToolContext, tool_response: Dict
) -> Optional[Dict]:
print(f"[Callback] After tool call for tool")
agent_name = tool_context.agent_name
tool_name = tool.name
print(f"[Callback] After tool call for tool '{tool_name}' in agent '{agent_name}'")
print(f"[Callback] Args used: {args}")
print(f"[Callback] Original tool_response: {tool_response}")
return None

Metadata

Metadata

Assignees

Labels

toolsIssues related to tools

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0