Skip to content

fix(kagent-adk): surface the sub-agent's ask_user question in remote_hitl_hint - #2495

Merged
EItanya merged 1 commit into
kagent-dev:mainfrom
vramahandry:fix/remote-hitl-hint-ask-user-question-python
Aug 19, 2026
Merged

fix(kagent-adk): surface the sub-agent's ask_user question in remote_hitl_hint#2495
EItanya merged 1 commit into
kagent-dev:mainfrom
vramahandry:fix/remote-hitl-hint-ask-user-question-python

Conversation

@vramahandry

Copy link
Copy Markdown
Contributor

Summary

remote_hitl_hint() in the Python kagent-adk runtime builds the hint text shown to a human when a sub-agent's own HITL pause bubbles up to the parent agent. Unlike the Go runtime's RemoteHitlHint(), it only ever lists the paused tool's name (e.g. ask_user) — never the actual question — even though AskUserRequest.questions (set directly on the request in build_hitl_status_message, whether or not nested is populated) has the real content right there.

  • Before: "Remote agent 'github_agent' requires approval for tool(s): ask_user"
  • After: "Remote agent 'github_agent' asks: What is the GitHub owner/org for the repo?"

Real tool-approval hints (the non-ask_user case) are unaffected.

This is the Python-runtime counterpart to #2475, which fixed the same class of bug in go/adk/pkg/a2a/hitl.go. The Go and Python runtimes maintain independent implementations of this HITL hint logic, and the Python side never had question-surfacing added — so a parent agent built on kagent-adk still drops the question today even after #2475 merges.

Unlike the Go fix, there's no []any vs []map[string]any] JSON-decode subtlety to worry about here: Pydantic's HitlTool.args: dict[str, Any] keeps nested question dicts intact, so reading AskUserRequest.questions directly is straightforward in both the direct and nested case.

Fixes #2473

Changes

  • python/packages/kagent-adk/src/kagent/adk/_hitl.py: remote_hitl_hint() now checks AskUserRequest.questions first and returns "Remote agent '{name}' asks: {question}" when present, falling back to the existing tool-name-only wording otherwise.
  • python/packages/kagent-adk/tests/unittests/test_hitl.py: adds test_remote_hitl_hint_tool_approval, test_remote_hitl_hint_ask_user, and test_remote_hitl_hint_ask_user_nested (the last covering a two-level nested ask_user pause).

Test plan

  • uv run pytest packages/kagent-adk/tests/unittests/test_hitl.py — 18 passed (3 new)
  • uv run ruff format --diff / uv run ruff check — clean
  • Existing tests unaffected — no changes to tool-approval hint wording

…hitl_hint

remote_hitl_hint() in the Python kagent-adk runtime only ever listed
the paused tool's name (e.g. "ask_user"), never the actual question
text, even though AskUserRequest.questions already carries it (set
directly on the request in build_hitl_status_message, whether or not
nested is populated). A human relaying a bubbled-up sub-agent HITL
pause saw "requires approval for tool(s): ask_user" with no way to
know what was actually being asked.

This mirrors the same fix already made in go/adk/pkg/a2a/hitl.go
(kagent-dev#2475) for the Go runtime's RemoteHitlHint(); the two runtimes
maintain independent implementations of this hint logic and the
Python side never had question-surfacing added.

Fixes kagent-dev#2473

Signed-off-by: Vivien Ramahandry <56304555+vramahandry@users.noreply.github.com>
@vramahandry
vramahandry requested a review from a team as a code owner August 19, 2026 08:59
@github-actions github-actions Bot added the bug Something isn't working label Aug 19, 2026
@EItanya
EItanya requested a review from supreme-gg-gg August 19, 2026 13:40
@EItanya
EItanya merged commit 481ce2f into kagent-dev:main Aug 19, 2026
30 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] RemoteHitlHint drops the sub-agent's actual ask_user question, only names the tool

3 participants