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

Aperta
#8,305 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

@sanketpatil06 ci sta già lavorando.

Dal 23/11/2026.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python
Ambito
ai, api

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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).
Lingua principale
Python
Stelle
22.3k
Fork
4.4k
Merge medio
1g 2h
PR unite (30g)
6

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di google/adk-python

Tutte le issue di google/adk-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.