Skip to content

fix(a2a): use final text when finish_task has no call args - #7769

Open
mangeshraut712 wants to merge 6 commits into
google:mainfrom
mangeshraut712:tip/remote-a2a-finish-task-response-output
Open

mangeshraut712 wants to merge 6 commits into
google:mainfrom
mangeshraut712:tip/remote-a2a-finish-task-response-output

Conversation

@mangeshraut712

Copy link
Copy Markdown

Summary

Custom A2A servers can complete a task-mode delegation with only a finish_task FunctionResponse (result="Task completed.") and put the actual answer in text parts of the same event. _find_finish_task_args_from_history then returns None, and we used to set session_state[A2A_METADATA_PREFIX + "output"] = {}.

When args are missing, prefer the remote event's non-thought text (unwrap with the wrapper key when present; otherwise wrap under FINISH_TASK_DEFAULT_WRAPPER_KEY) so the parent still receives the answer. Empty text still yields {} with the existing warning.

Fixes #7746.

Test plan

  • pytest tests/unittests/a2a/agent/test_remote_a2a_agent.py -k OutputUnwrapping (7 passed)
  • New test_finish_task_response_only_uses_final_text

mangeshraut712 and others added 6 commits October 27, 2026 09:09
Custom A2A servers may complete a task-mode delegation with only a
finish_task FunctionResponse (result="Task completed.") and put the
answer in text parts of the same event. Args lookup then returns None
and we used to set output={}. Prefer the remote's non-thought text so
the parent still receives the answer. Fixes google#7746.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant