Backport 2153 to 0.10.x release - #2373
Merged
EItanya merged 1 commit intoJul 31, 2026
Merged
Conversation
supreme-gg-gg
requested review from
a team,
Charlesthebird and
peterj
as code owners
July 31, 2026 15:42
…ev#2153) ## Summary Fixes kagent-dev#2137 The bug : every call a parent agent makes to a sub-agent (Agent tool) reuses the same A2A **context_id** since it's minted once when the tool is built. worker just uses that **context_id** as its session id directly ( **executor.go: sessionID := reqCtx.ContextID** ) so if a coordinator fires off N parallel calls to the same sub-agent in one turn , they all pile into a single shared session instead of getting their own. Fix is an opt-in **IsolateSessions** flag on Agent-type tools : ```yaml spec: declarative: tools: - type: Agent agent: name: worker isolateSessions: true # each call to worker gets its own session ``` Default behavior (flag unset/false) doesn't change one **context_id** for the tool's whole lifetime so stateful sub-agents keep their session continuity. with the flag on we mint a fresh **context_id** on every call so each invocation is isolated. Doesn't touch the **x-kagent-root-context-id** header stuff. that's still what carries cross-turn continuity and it stays stable either way. ## What changed - `agent_types.go`: added `Tool.IsolateSessions *bool` plus a CEL rule so it can only be set when `type: Agent` - `adk/types.go`: `RemoteAgentConfig.IsolateSessions bool` - `compiler.go`: passes the flag through into `RemoteAgentConfig` - `agent.go`: forwards the flag to `NewKAgentRemoteA2ATool`. also skips adding an entry to `subagentSessionIDs` when isolated since there's no single session id to pre-stamp function_call parts with anymore - `remote_a2a_tool.go`: added `isolateSessions` plus a small `nextContextID()` helper that either returns the stable id or mints a new one. This gets reported back as `subagent_session_id` - Python `types.py`: added `isolate_sessions` for schema parity only, it doesn't do anything on that side yet (matches what the issue scoped out) - Regenerated CRDs/deepcopy with `make controller-manifests` - Added a test for the new context-id logic and a golden fixture (`agent_with_isolated_session_tool`) to check it flows through the whole translation pipeline ## About the UI Isolated tools don't have one fixed session id, so the executor can't pre-populate the stamp map for them at startup. Instead the UI grabs the session id per call from `subagent_session_id` in the function_response. `AgentCallDisplay` already reads that field, so nothing new needed there. ## Not doing in this PR - Not a concurrency limiter, that's separate (`max-concurrency.md`) - HITL resume is unaffected, it still uses the context_id from the confirmation payload - Only the Go runtime respects this flag right now. Python accepts it for config parity but the low-level tool doesn't use it yet ## Tests Ran `go test ./adk/pkg/tools/... ./adk/pkg/agent/... ./api/...` and the golden translator tests. Everything passes. Confirmed `isolate_sessions: true` shows up correctly in the generated `config.json` for the new fixture. ## One small thing I noticed In `handleResume`, `processResult` now sets `subagent_session_id` from the contextID I pass in, but there's older code right after it that sets the same key again with a fallback to `lastContextID`. Not wrong, just a bit redundant now since it writes the same value twice in the normal case. Left it as is since it's harmless but flagging it in case someone wants it cleaned up. --------- Signed-off-by: Yashraj Shukla <shuklayashraj68@gmail.com> Co-authored-by: Eitan Yarmush <eitan.yarmush@solo.io> Signed-off-by: Jet Chiang <pokyuen.jetchiang-ext@solo.io>
supreme-gg-gg
force-pushed
the
backport/isolate-agent-sessions
branch
from
July 31, 2026 15:43
30b1c7b to
4ecfca8
Compare
EItanya
approved these changes
Jul 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#2153