From 5611ff40e7ace8157fbeee97d459178e988862f3 Mon Sep 17 00:00:00 2001 From: Adam Weidman <65992621+adamfweidman@users.noreply.github.com> Date: Sun, 17 May 2026 13:38:34 -0400 Subject: [PATCH] feat(core): add adk.agentSessionSubagentEnabled flag (#26947) --- docs/reference/configuration.md | 6 ++++++ packages/cli/src/config/settingsSchema.test.ts | 12 ++++++++++++ packages/cli/src/config/settingsSchema.ts | 10 ++++++++++ packages/core/src/config/config.ts | 8 ++++++++ schemas/settings.schema.json | 7 +++++++ 5 files changed, 43 insertions(+) diff --git a/docs/reference/configuration.md b/docs/reference/configuration.md index e2250a3dbb..37959b7f95 100644 --- a/docs/reference/configuration.md +++ b/docs/reference/configuration.md @@ -1854,6 +1854,12 @@ their corresponding top-level category object in your `settings.json` file. - **Default:** `false` - **Requires restart:** Yes +- **`experimental.adk.agentSessionSubagentEnabled`** (boolean): + - **Description:** Route subagent invocations through the AgentSession + protocol instead of legacy executors. + - **Default:** `false` + - **Requires restart:** Yes + - **`experimental.enableAgents`** (boolean): - **Description:** Enable local and remote subagents. - **Default:** `true` diff --git a/packages/cli/src/config/settingsSchema.test.ts b/packages/cli/src/config/settingsSchema.test.ts index 368302890d..914ef21a64 100644 --- a/packages/cli/src/config/settingsSchema.test.ts +++ b/packages/cli/src/config/settingsSchema.test.ts @@ -571,6 +571,18 @@ describe('SettingsSchema', () => { expect(agentSessionNoninteractiveEnabled.description).toBe( 'Enable non-interactive agent sessions.', ); + + const agentSessionSubagentEnabled = + adk.properties.agentSessionSubagentEnabled; + expect(agentSessionSubagentEnabled).toBeDefined(); + expect(agentSessionSubagentEnabled.type).toBe('boolean'); + expect(agentSessionSubagentEnabled.category).toBe('Experimental'); + expect(agentSessionSubagentEnabled.default).toBe(false); + expect(agentSessionSubagentEnabled.requiresRestart).toBe(true); + expect(agentSessionSubagentEnabled.showInDialog).toBe(false); + expect(agentSessionSubagentEnabled.description).toBe( + 'Route subagent invocations through the AgentSession protocol instead of legacy executors.', + ); }); }); diff --git a/packages/cli/src/config/settingsSchema.ts b/packages/cli/src/config/settingsSchema.ts index 610f2e2a61..e3d68415e9 100644 --- a/packages/cli/src/config/settingsSchema.ts +++ b/packages/cli/src/config/settingsSchema.ts @@ -2194,6 +2194,16 @@ const SETTINGS_SCHEMA = { 'Enable the agent session implementation for the interactive CLI.', showInDialog: false, }, + agentSessionSubagentEnabled: { + type: 'boolean', + label: 'Agent Session Subagent Enabled', + category: 'Experimental', + requiresRestart: true, + default: false, + description: + 'Route subagent invocations through the AgentSession protocol instead of legacy executors.', + showInDialog: false, + }, }, }, enableAgents: { diff --git a/packages/core/src/config/config.ts b/packages/core/src/config/config.ts index 1568207936..18ff941cfd 100644 --- a/packages/core/src/config/config.ts +++ b/packages/core/src/config/config.ts @@ -237,6 +237,7 @@ export interface GemmaModelRouterSettings { export interface ADKSettings { agentSessionNoninteractiveEnabled?: boolean; agentSessionInteractiveEnabled?: boolean; + agentSessionSubagentEnabled?: boolean; } export interface ExtensionSetting { @@ -913,6 +914,7 @@ export class Config implements McpContext, AgentLoopContext { private readonly gemmaModelRouter: GemmaModelRouterSettings; private readonly agentSessionNoninteractiveEnabled: boolean; private readonly agentSessionInteractiveEnabled: boolean; + private readonly agentSessionSubagentEnabled: boolean; private readonly retryFetchErrors: boolean; private readonly maxAttempts: number; @@ -1359,6 +1361,8 @@ export class Config implements McpContext, AgentLoopContext { params.adk?.agentSessionNoninteractiveEnabled ?? false; this.agentSessionInteractiveEnabled = params.adk?.agentSessionInteractiveEnabled ?? false; + this.agentSessionSubagentEnabled = + params.adk?.agentSessionSubagentEnabled ?? false; this.retryFetchErrors = params.retryFetchErrors ?? true; this.maxAttempts = Math.min( params.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, @@ -2573,6 +2577,10 @@ export class Config implements McpContext, AgentLoopContext { return this.contextManagement.enabled; } + isAgentSessionSubagentEnabled(): boolean { + return this.agentSessionSubagentEnabled; + } + getMemoryBoundaryMarkers(): readonly string[] { return this.memoryBoundaryMarkers; } diff --git a/schemas/settings.schema.json b/schemas/settings.schema.json index 2bcde8bc6f..d9d2e82989 100644 --- a/schemas/settings.schema.json +++ b/schemas/settings.schema.json @@ -3223,6 +3223,13 @@ "markdownDescription": "Enable the agent session implementation for the interactive CLI.\n\n- Category: `Experimental`\n- Requires restart: `yes`\n- Default: `false`", "default": false, "type": "boolean" + }, + "agentSessionSubagentEnabled": { + "title": "Agent Session Subagent Enabled", + "description": "Route subagent invocations through the AgentSession protocol instead of legacy executors.", + "markdownDescription": "Route subagent invocations through the AgentSession protocol instead of legacy executors.\n\n- Category: `Experimental`\n- Requires restart: `yes`\n- Default: `false`", + "default": false, + "type": "boolean" } }, "additionalProperties": false