feat(conformance): Skips recording for inner runner of AgentTool in conformance tests

PiperOrigin-RevId: 809252704
This commit is contained in:
Wei Sun (Jack)
2025-09-19 17:36:18 -07:00
committed by Copybara-Service
parent 9be9cc2fee
commit 6e834d3fac
2 changed files with 13 additions and 3 deletions
+6 -2
View File
@@ -138,8 +138,12 @@ class ReplayPlugin(BasePlugin):
recording = self._verify_and_get_next_tool_recording_for_agent(
state, agent_name, tool.name, tool_args
)
# Execute the actual tool to get state updates.
await tool.run_async(args=tool_args, tool_context=tool_context)
from google.adk.tools.agent_tool import AgentTool
if not isinstance(tool, AgentTool):
# TODO: support replay requests and responses from AgentTool.
await tool.run_async(args=tool_args, tool_context=tool_context)
logger.debug(
"Verified and replaying tool response for agent %s: tool=%s",
+7 -1
View File
@@ -134,10 +134,16 @@ class AgentTool(BaseTool):
credential_service=tool_context._invocation_context.credential_service,
plugins=list(tool_context._invocation_context.plugin_manager.plugins),
)
state_dict = {
k: v
for k, v in tool_context.state.to_dict().items()
if not k.startswith('_adk') # Filter out adk internal states
}
session = await runner.session_service.create_session(
app_name=self.agent.name,
user_id=tool_context._invocation_context.user_id,
state=tool_context.state.to_dict(),
state=state_dict,
)
last_content = None