Add agentSessionSubagentEnabled setting under experimental.adk that
routes subagent invocations through LocalSessionInvocation and
RemoteSessionInvocation instead of legacy executors. When disabled
(default), all behavior is unchanged.
- Add agentSessionSubagentEnabled to ADKSettings, Config, and settings schema
- Thread onAgentEvent callback through AgentTool → DelegateInvocation
- Route local/remote agents to session invocations when flag is enabled
- Browser agent always uses BrowserAgentInvocation regardless of flag
- Copy local protocol files needed for the session invocation path
Two changes:
1. RemoteSessionInvocation now uses a composite key (name::targetUrl)
for the static sessionState map. This ensures agents with the same
name but different endpoints maintain independent A2A state. Falls
back to name-only when no URL can be derived.
2. AgentRegistry.registerAgent now emits a visible warning when a
different definition tries to register under an existing name.
Override still proceeds to preserve existing precedence order
(user → project → extension). The warning surfaces potential
naming conflicts to users.
New invocation class that delegates to RemoteSubagentSession instead of
directly managing A2A client streaming. Existing RemoteAgentInvocation is
untouched — this will be wired in behind a feature flag in a later PR.
Key behaviors:
- Static sessionState map persists A2A contextId/taskId across invocations
- Subscribes to session message events for live SubagentProgress updates
- Detects post-getResult abort and surfaces proper error state
- Includes partial output in error display via getLatestProgress()
- Properly cleans up abort listeners and subscriptions in finally block
Also adds initialState param and getSessionState() to
RemoteSubagentProtocol/RemoteSubagentSession for cross-invocation
state persistence.
Use typeof check and trim to avoid displaying 'undefined' for missing properties in THOUGHT_CHUNK, TOOL_CALL_START, TOOL_CALL_END, and ERROR events.
TAG=agy
CONV=d4b1d79a-226d-4301-8d60-bdb5d4701569
New invocation class that delegates to LocalSubagentSession instead of
directly using LocalAgentExecutor. Existing LocalSubagentInvocation is
untouched — this will be wired in behind a feature flag in a later PR.