A2aAgentExecutor has no native way to emit TaskState.rejected on the server side

未关闭
#8,305 1 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 3 天内回复

@sanketpatil06 已经在做这个了。

开始于 2026年11月23日。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
python
领域
ai, api

调研方向

Start in google/adk/a2a/executor/a2a_agent_executor_impl.py around _handle_request and in google/adk/a2a/executor/task_result_aggregator.py where terminal states are tracked, then check google/adk/a2a/converters/to_adk_event.py to see how TS_REJECTED is already read on the client side. Settle on a server-side signal (exception type or event action flag) with the maintainers before coding. Done means a rejection maps to TS_REJECTED with priority above completed and distinct from failed, with tests covering both paths.

由索引模型根据 Issue 内容生成。

描述

a2a needs review
Environment
  • google-adk==2.15.0
  • a2a-sdk==0.3.26
  • Python 3.12
Problem

In the A2A specification, TaskState.rejected (TASK_STATE_REJECTED in v1.0) represents a policy/business refusal distinct from a technical execution failure (failed).

In google-adk==2.15.0:

  • The client converter (google/adk/a2a/converters/to_adk_event.py:70) recognizes _compat.TS_REJECTED in _TASK_RESPONSE_BOUNDARY_STATES.
  • On the server side, A2aAgentExecutor (google/adk/a2a/executor/a2a_agent_executor_impl.py:266-297) and TaskResultAggregator (google/adk/a2a/executor/task_result_aggregator.py:55-60) only track canceled, failed, auth_required, input_required, working, and completed. There is no ADK primitive (tool return contract, EventActions field, or mapped exception) for an agent or tool exposed via to_a2a() to emit TaskState.rejected.

Without a workaround, policy refusals end up either as completed (if the tool returns a refusal dict and the LLM explains it in text) or as failed (if an uncaught exception is raised, which clients interpret as a transient error rather than a semantic rejection).

Workaround
  1. Record a rejection reason from the remote tool / callback (e.g. in session-scoped store or state).
  2. In an ExecuteInterceptor.after_agent passed to A2aAgentExecutorConfig, replace the terminal TS_COMPLETED TaskStatusUpdateEvent with a new TaskStatusUpdateEvent carrying _compat.TS_REJECTED (final=True) and the refusal message.
Suggested Fix in ADK

Provide a native server-side signal in ADK mapped by TaskResultAggregator / A2aAgentExecutor to _compat.TS_REJECTED — for example:

  • a dedicated exception type (e.g. A2aTaskRejectedError or policy rejection error) or an EventActions / ToolContext action flag honored by TaskResultAggregator and A2aAgentExecutor._handle_request (with priority above completed and distinct from failed).
主要语言
Python
星标
22.3k
派生
4.4k
平均合并
1 天 2 小时
30 天内合并 PR
6

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

google/adk-python 的其他 Issue

查看 google/adk-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。