You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BigQuery Agent Analytics: transfer_to_agent targets parented to invocation root under DynamicNodeScheduler #6665
When agents hand off via transfer_to_agent under ADK 2.x DynamicNodeScheduler, BigQuery Agent Analytics writes the target agent's AGENT_STARTING row with parent_span_id pointing at the invocation root, not the transferring agent (or the transfer_to_agent tool span). The transferred-to agent therefore appears as a sibling of the caller in any tree reconstructed from parent_span_id.
This is systemic for multi-agent runs on the workflow scheduler path (not AgentTool).
Environment
Observed on google-adk 2.3.0; relevant code paths (TraceManager / _resolve_ids / _llm_agent_wrapper transfer breakout / DynamicNodeScheduler.create_task) are unchanged through 2.6.3.
Expected
Target agent span nests under the transferring agent span (or under the open tool span), matching live OpenTelemetry parenting (invoke_agent nesting).
DynamicNodeScheduler launches each node with asyncio.create_task(...).
_llm_agent_wrapper breaks out of the caller on transfer_to_agent and returns control to the coordinator (legacy nested agent_to_run.run_async in base_llm_flow is bypassed on the modern path).
TraceManager keeps the BQ span stack in a bare ContextVar (_span_records_ctx). Sibling node tasks do not share the caller's pushed agent span.
OTel parenting still works because ADK carries TelemetryContext.otel_context on the workflow Context object and re-attaches it in node_tracing — that object survives the task boundary; the BQ plugin stack does not.
Suggested direction
Keep BQ span IDs self-consistent (do not borrow unlogged OTel span IDs), but propagate the caller's plugin agent span id across the scheduler task boundary — e.g. stash it on the workflow Context (mirroring TelemetryContext) or an invocation-keyed map on the plugin — and use it as parent_span_id when a node starts with an otherwise-empty agent stack after a transfer.
Happy to provide a minimal repro or sample agent_events_v2 rows if useful.
Activity
ckarlsen84 commentedon Aug 10, 2026
Closing — opened in error; not intending to pursue this as an upstream request from this side.