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

Đang mở
#8,305 1 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 3 ngày

@sanketpatil06 đang làm issue này rồi.

Từ ngày 23/11/2026.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
ai, api

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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).
Ngôn ngữ chính
Python
Star
22.3k
Fork
4.4k
Merge trung bình
1 ngày 2 giờ
Pull request đã merge (30 ngày)
6

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của google/adk-python

Tất cả issue của google/adk-python

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.