Skip to content

A2A (new executor): a state-only event becomes a status update whose agent message has no parts, and it lands in task history #8357

Description

@Shay-Deng

Describe the bug

With the new A2A executor (A2aAgentExecutor(force_new_version=True), or any client that requests the ADK A2A extension), an ADK event that carries only actions (for example the state change from a before_agent_callback) is converted into a TASK_STATE_WORKING status update whose status.message has an empty parts list. The a2a-sdk task manager then appends that message to task.history, so GetTask and the SendMessage response return an agent message with no parts.

A2A v1.0 marks Message.parts as REQUIRED, and §5.7 says: "Arrays marked as required MUST contain at least one element." The legacy executor does not produce this message for the same agent.

The block is in convert_event_to_a2a_events in src/google/adk/a2a/converters/from_adk_event.py (main 4e3aff7, around L205–L220): when an event has no content parts but has actions, it builds Message(..., parts=[]) to carry the actions metadata.

To Reproduce

google-adk 2.15.1 (main 4e3aff7), a2a-sdk 1.3.1:

from google.adk.a2a.executor.a2a_agent_executor import A2aAgentExecutor
from google.adk.a2a.utils.agent_to_a2a import to_a2a
from google.adk.agents import BaseAgent
from google.adk.events import Event
from google.genai import types


class EchoAgent(BaseAgent):
  async def _run_async_impl(self, ctx):
    text = ctx.user_content.parts[0].text
    yield Event(author=self.name, invocation_id=ctx.invocation_id,
                content=types.Content(role='model', parts=[types.Part(text=f'echo: {text}')]))


def remember_turn(callback_context):
  callback_context.state['turns'] = callback_context.state.get('turns', 0) + 1


app = to_a2a(
    EchoAgent(name='echo_agent', before_agent_callback=remember_turn),
    host='127.0.0.1', port=10404,
    agent_executor_factory=lambda r: A2aAgentExecutor(runner=r, force_new_version=True),
)

Run it with uvicorn, then send {"jsonrpc":"2.0","id":1,"method":"SendMessage","params":{"message":{"messageId":"m1","role":"ROLE_USER","parts":[{"text":"hi"}]}}}.

result.task.history is:

[
  {"messageId": "m1", "role": "ROLE_USER", "parts": [{"text": "hi"}], ...},
  {"messageId": "...", "role": "ROLE_AGENT", "metadata": {"adk_actions": {"stateDelta": {"turns": 1.0}}, ...}}
]

The second message has no parts. With SendStreamingMessage, the same message appears as the status.message of a TASK_STATE_WORKING status update. Without force_new_version (legacy executor), the history holds the agent's echo: hi reply instead.

Expected behavior

No agent message with empty parts in status updates or in task history. The actions could travel in the status update event's own metadata (or the event could be skipped when there is nothing else to send), but that depends on how RemoteA2aAgent reads them back, so I've left the choice open.

Additional context

Found while running the A2A conformance suites (a2a-tck and the a2a-itk ACTS corpus) against to_a2a(). Neither suite checks history messages for empty parts today. I'm happy to open a PR once the preferred shape is clear.

Activity

  1. KilianTheMagnificent commented on Nov 26, 2026

    @KilianTheMagnificent

    Independent confirmation, plus two details that may help pick the fix shape.

    Reproduced offline on published google-adk 2.15.1 and on main at 9fd6b33 (a2a-sdk 1.3.1, Python 3.12.13, macOS arm64), using the reporter's app under local uvicorn on 127.0.0.1, with the A2A-Version: 1.0 header. Line numbers below are for main at 9fd6b33; 2.15.1 has the same code 2–3 lines lower.

    • SendMessage and GetTask: task.history[1] is ROLE_AGENT with no parts and metadata.adk_actions = {"stateDelta": {"turns": 1.0}}.
    • SendStreamingMessage: task SUBMITTED → statusUpdate WORKING → statusUpdate WORKING with that same parts-less agent message → artifactUpdate (echo: hi) → statusUpdate COMPLETED.
    • Control, force_new_version=False: history[1] is the echo: hi agent message; no parts-less message anywhere.

    1. It isn't limited to state changes. The guard at from_adk_event.py L205, elif _serialize_value(event.actions) is not None:, is always true for an event with no content parts: _serialize_value(EventActions()) returns {'stateDelta': {}}, not None. So these all produce the parts-less message (checked through convert_event_to_a2a_events): state-only, artifact_delta-only, escalate-only, transfer-only, skip_summarization-only, requested-auth-only, usage-metadata-only, content with parts=[], and even an Event with no content and no actions (live, that last one lands in task.history as a message with adk_actions: {"stateDelta": {}}). The Message(..., parts=[]) at L206–209 is the only parts-less Message construction in a2a/; the other agent messages (error, long-running, legacy event_converter) always carry parts or return None.

    2. What the ADK reader does with that message. convert_a2a_status_update_to_event reads actions from status.message.metadata (to_adk_event.py L726), which is what RemoteA2aAgent's new-path handler calls, but honors only escalate and skip_summarization (_PEER_SETTABLE_ACTION_FIELDS, L317). In a round trip, escalate-only and skip_summarization-only come back as events with those flags. State-only, artifact_delta-only, transfer-only, auth-only and empty events come back as no event at all, logging Ignoring a session state delta from a remote A2A peer (for a state delta) and No parts could be converted from A2A message. So for those shapes the message carries nothing an ADK client uses, and for the other two moving the actions to the update's own metadata would need a matching change in the reader.

    Disclosure: an AI agent (Claude) ran these checks and drafted this comment on my behalf, and a second, independent AI pass re-ran them before posting. Every output quoted above comes from a real local run. Scripts and full output available on request.

  2. 08raviyadav commented on Nov 26, 2026

    @08raviyadav

    Hi, I reproduced this and would like to fix it. Proposed shape (matching the legacy executor, which emits nothing for content-less events):

    • A content-less event carrying only actions no remote peer honors back (state delta, artifact delta, transfer, auth configs, usage metadata — or nothing at all) emits no A2A event.
    • A content-less event carrying escalate or skip_summarization (the only actions the reader rebuilds from peer metadata) emits a message-less WORKING TaskStatusUpdateEvent, with the full event metadata on the update's own metadata field. The reader falls back to the update's metadata when there is no status message, so the flags survive the round trip. No Message with empty parts is ever built.
    • I deliberately did not fabricate a text part or smuggle the actions into a DataPart.

    Two things I want to flag rather than guess: usage-metadata-only events are skipped like legacy, so usage info for content-less events is dropped on the wire; and I'm leaving convert_a2a_task_to_event (task-level) untouched. If that shape sounds right, I'll open a PR with the fix and regression tests (including a round-trip test).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions