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

Offen
#8,305 1 Kommentar 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

Maintainer antworten meist innerhalb von 3 Tagen

@sanketpatil06 arbeitet bereits daran.

Seit 23.11.2026.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
25/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
python
Bereich
ai, api

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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).
Vorherrschende Sprache
Python
Sterne
22.3k
Forks
4.4k
Ø Merge
1 T. 2 Std.
Gemergte PRs (30 T.)
6

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus google/adk-python

Alle Issues in google/adk-python

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.