Skip to content

feat(api): run subagents in their own Session - #3677

Open
dimetron wants to merge 1 commit into
kagent-dev:mainfrom
dimetron:dimetron/feat/subagent-session-isolation
Open

dimetron wants to merge 1 commit into
kagent-dev:mainfrom
dimetron:dimetron/feat/subagent-session-isolation

Conversation

@dimetron

Copy link
Copy Markdown
Collaborator

Part of #3674 (split out of the reference implementation in #3673).

What

Adds SubAgentToolBinding.isolation to AgentTemplate/Agent (v1alpha3):

Value Behavior
Shared (default / omitted) Current behavior: the subagent is transferred to and shares the parent's session and history.
Session The subagent is invoked as an agent tool and runs in its own session; only its final result returns to the parent.

Shared stays unset in the compiled ADK config, so existing revisions and digests do not change.

Proto: new ADKAgentIsolation enum (UNSPECIFIED, SHARED, SESSION) and ADKAgentConfig.isolation = 20 with defined_only validation.

Constraints (enforced in the translator and again in the Go ADK runtime)

  • Only the kagent and BYO harnesses support Session; Codex and Claude reject it (Compatible=False, UnsupportedConfiguration).
  • A Session subagent cannot pause for human approval: MCP bindings with requireApproval are rejected and it gets no ask_user tool.
  • Session cannot be combined with STS token exchange (the exchanged token is cached per session).
  • The root agent must leave isolation unspecified.

Changes

  • API + CRDs (make controller-manifests), proto + generated Go/Python (make proto-generate).
  • Translator: plumbs isolation, validateSubAgentIsolation, adkconfig.ValidateSubAgentIsolation.
  • Go ADK runtime: Session children become agenttool tools; standalone checks.
  • UI: "Own session" checkbox on subagent bindings in the AgentTemplate form.
  • Docs: "Session isolation" section in docs/architecture/a2a-subagents.md.

Tests

  • go test ./api/v1alpha3/ (CEL: Session/Shared/omitted accepted, Isolated rejected) and ./core/internal/controller/ with envtest — pass
  • go test ./core/internal/translator/... ./adk/pkg/... — pass (isolation delivery, digest stability, harness rejection, approval, STS)
  • make -C go lint — 0 issues; make proto-lint, make proto-breaking vs upstream/main — pass
  • UI vitest, typecheck, lint — pass
  • New e2e TestSubAgentIsolationValidation compiles and vets; not run against a cluster locally.

Add SubAgentToolBinding.isolation (Shared|Session). A Session subagent is
invoked as an agent tool with its own session instead of sharing the parent
conversation. Supported on kagent and BYO harnesses only; rejected with
human approval and STS token exchange. Shared stays unset in compiled
config so existing revisions are unchanged.

Signed-off-by: Dmytro Rashko <dimetron@me.com>
@dimetron
dimetron requested review from a team and supreme-gg-gg as code owners November 13, 2026 22:23
@github-actions github-actions Bot added the enhancement New feature or request label Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant