Repository navigation
fix(a2a): don't drop state and artifact deltas in the legacy converter - #8020
Open
AtulJoshi1206 wants to merge 1 commit into
Open
AtulJoshi1206 wants to merge 1 commit into
AtulJoshi1206 wants to merge 1 commit into
Conversation
The legacy event converter only produced A2A events for an ADK event that has an error or content. An event with neither that still changes the session converted to nothing. ADK emits exactly that kind of event when an agent callback saves an artifact or sets state, and when the built-in code executor saves a generated image. Because no A2A event was produced, no after_event interceptor ever saw it, so include_artifacts_in_a2a_event_interceptor never published those artifacts and the deltas never reached the client in the event metadata. The converter used by the new executor has emitted a working status update for such events since dcc485b. The legacy converter did not, and it is still what every client gets unless it opts into the new integration extension (RemoteA2aAgent defaults to use_legacy=True). Emit a working status update, carrying the event metadata and no message, when an event has no content and no error but has a state or artifact delta. TaskResultAggregator took every working update as the latest result. A message-less update that arrives after the final answer, which is what an after_agent_callback that saves a file produces, would clear the answer, and the final result artifact would not be published. A working update without a message now leaves the recorded result alone.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
2. Or, if no issue exists, describe the change:
Problem:
The legacy A2A event converter only produces A2A events for an ADK event that has an error or content. An event that has neither but still changes the session converts to nothing. ADK emits that kind of event in a few common places:
NoneSaved as artifact: chart.png.Since nothing is emitted, no
after_eventinterceptor ever sees these events. Withinclude_artifacts_in_a2a_event_interceptorconfigured, the client gets the "Saved as artifact" text but never the chart, and an artifact saved inafter_agent_callbacknever shows up in the task. The deltas also never reach the client in the event metadata.The new executor's converter already handles this: dcc485b made it emit a working status update for an event with no parts but with actions. The legacy converter never got the same change, and it's still the default.
A2aAgentExecutoruses it unless the client requests the new integration extension, andRemoteA2aAgentdefaults touse_legacy=True.Solution:
convert_event_to_a2a_events: when an event has no content and no error but has astate_deltaorartifact_delta, emit a workingTaskStatusUpdateEventwith the event metadata and no message. I limited it to session deltas instead of "any non-default actions" so checkpoint-only events (end_of_agent,agent_state) don't start showing up in the legacy stream.TaskResultAggregator: a working update replaced the recorded result even when it had no message. With the converter change, anafter_agent_callbackthat saves a file after the final answer would wipe the answer, and the final result artifact wouldn't be published. A working update without a message now leaves the result alone.Testing Plan
Unit Tests:
test_artifact_saved_by_agent_callback_is_publishedruns a realRunnerthroughA2aAgentExecutor.executeon both executor versions, with the interceptor enabled. The runner has anLlmAgentwhoseafter_agent_callbacksavesreport.txt, plus anInMemoryArtifactService. The test checks that both the artifact and the answer are published.assert 'quarterly numbers' in ['Report is ready.'].'Report is ready.' in ['quarterly numbers']). That's why the aggregator change is needed.The converter and aggregator changes each have their own unit test too.
Manual End-to-End (E2E) Tests:
I ran the built-in code executor case through
A2aAgentExecutorwith the interceptor enabled and a mocked model that returns an inline PNG:Checklist
Additional context
This is separate from #6777, which maps
Event.outputinto the message. There, an output-only workflow event goes through the message path. This change covers events that only carry deltas, and the two work together.