feat(a2a): save artifacts returned by RemoteA2aAgent to the orchestrator session#6184
Open
vaibhav-patel wants to merge 2 commits into
Open
feat(a2a): save artifacts returned by RemoteA2aAgent to the orchestrator session#6184vaibhav-patel wants to merge 2 commits into
vaibhav-patel wants to merge 2 commits into
Conversation
When a RemoteA2aAgent receives artifacts (e.g. files) from a remote A2A agent, persist them into the orchestrator (parent) session's artifact service so downstream agents can load them via context.load_artifact. Previously, A2A artifacts were only flattened into the event's content parts and never written to the artifact service, so the orchestrator and sibling agents had no durable, named handle to the returned files. Both the full-task response (task.artifacts) and streaming artifact updates (TaskArtifactUpdateEvent.artifact) are handled, in the legacy and v2 response handlers. Each artifact's blob-like part (FilePart / FileWithBytes / FileWithUri, or inline data) is saved under the artifact's name (falling back to its id), and the resulting version is recorded on the event's artifact_delta. Saving is best-effort: it is a no-op when no artifact service is configured and never breaks A2A response handling on a per-artifact failure. Fixes google#3145.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Author
|
@googlebot I signed it! |
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.
Summary
Fixes #3145.
When a
RemoteA2aAgentreceives artifacts (e.g. files) from a remote A2A agent, they are now persisted into the orchestrator (parent) session's artifact service, so downstream/sibling agents can load them viacontext.load_artifact(...).Previously, artifacts in an A2A response were only flattened into the event's content parts (
convert_a2a_task_to_event) and never written to the artifact service, so the orchestrator had no durable, named handle to the returned files.What changed
RemoteA2aAgent._save_a2a_artifacts_to_session(...)that:FilePart/FileWithBytes/FileWithUri, or inline data) under the artifact'sname(falling back to itsartifact_id);actions.artifact_delta;_handle_a2a_response) and v2 (_handle_a2a_response_v2) handlers, covering full-task responses (task.artifacts) and streaming artifact updates (TaskArtifactUpdateEvent.artifact).include_artifacts_in_a2a_eventinterceptor, completing the artifact round-trip across the A2A boundary.Tests
TestRemoteA2aAgentArtifactPersistence(7 tests) using a realInMemoryArtifactServiceand real A2A objects, asserting artifacts land in the service andartifact_deltais populated; covers inline bytes, file-by-URI, multiple artifacts,artifact_idfallback, no-service no-op, and text-only (skipped) artifacts.RemoteA2aAgentanda2aunit tests pass (467 passed locally).Note: experimental A2A surface (
@a2a_experimental); behavior is additive and gated on an artifact service being present.