AgentTool does not propagate plugins to child Runner, causing missing trace spans and event streaming
Description
When using AgentTool to wrap a sub-agent, the child Runner created in agent_tool.py does not inherit the plugins from the parent invocation context. This causes:
- Missing parent spans in Cloud Trace - The trace view shows "Missing span ID..." for parent agent spans
- Plugin callbacks not executed for sub-agents - Custom plugins (like event streaming/logging) don't capture sub-agent activity
Current Behavior
In google/adk/tools/agent_tool.py lines 124-131:
runner = Runner(
app_name=self.agent.name,
agent=self.agent,
artifact_service=ForwardingArtifactService(tool_context),
session_service=InMemorySessionService(),
memory_service=InMemoryMemoryService(),
credential_service=tool_context._invocation_context.credential_service,
# plugins= is NOT passed
)
Expected Behavior
The child Runner should propagate plugins from the parent:
runner = Runner(
app_name=self.agent.name,
agent=self.agent,
artifact_service=ForwardingArtifactService(tool_context),
session_service=InMemorySessionService(),
memory_service=InMemoryMemoryService(),
credential_service=tool_context._invocation_context.credential_service,
plugins=tool_context._invocation_context.plugin_manager.plugins, # Add this
)
Environment
- ADK version: 1.8.0
- Deployment: Vertex AI Agent Engine
- Python: 3.11
Impact
- Cloud Trace shows "Missing span ID" labels for parent agent spans (child spans are still visible)
- Custom plugins registered on the root App are not invoked for sub-agents wrapped with AgentTool
- Event streaming/logging plugins miss sub-agent activity
Workaround
Currently requires creating a custom AgentTool subclass that overrides run_async to pass plugins.
@democodex Thanks for reporting this issue! Could you please try newer version (e.g. v1.20.0+) of ADK, we now have an include_plugins in AgentTool to control whether to propagate plugins (https://github.com/google/adk-python/blob/main/src/google/adk/tools/agent_tool.py#L48).
Closing this issue. Will reopen if it doesn't work for you.