mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
feat(conformance): Skips recording for inner runner of AgentTool in conformance tests
PiperOrigin-RevId: 809252704
This commit is contained in:
committed by
Copybara-Service
parent
9be9cc2fee
commit
6e834d3fac
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user