Repository navigation
feat: support metadata providers for remote A2A messages - #1679
Open
YuqiGuo105 wants to merge 1 commit into
Open
YuqiGuo105 wants to merge 1 commit into
YuqiGuo105 wants to merge 1 commit into
Conversation
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.
Link to Issue or Description of Change
Closes #1438.
Problem:
RemoteA2AAgenthas no application hook for populating an outgoing A2A message's metadata. Applications cannot explicitly pass selected context, such as a user or tenant identifier, without mixing it into conversation content.Solution:
A2ARequestMetadataProvidercallback andRemoteA2AAgent.Builder.requestMetadataProvider(...).Message.metadata. Preserve existing behavior when no provider is configured or the provider returnsnull; stop the send if the provider throws.Example builder configuration:
Testing Plan
Unit Tests:
beforeExecuteCallback, while existing request metadata propagation intoRunConfigis unchanged../mvnw -o -q -pl a2a -am test: the full core and A2A module test suites pass, including all 151 A2A tests.git diff --checkand applied the repository's Google Java formatting.Manual End-to-End (E2E) Tests:
Not run against a deployed remote agent. The tests exercise the sender, the SDK's JSON models, and the receiver callback locally; they do not claim transport-level E2E coverage. No model credentials or external services are needed for these tests.
Checklist
CONTRIBUTING.md.Additional context
This implements message-level metadata, as requested by #1438. On an ADK receiver it is readable via
RequestContext.getMessage().getMetadata(). It is not automatically copied into session state orRunConfig.customMetadata(); the latter's existinga2a_metadatapath consumes request-envelope metadata instead.The current Python
a2a_request_meta_providerpopulates request-level metadata. This PR does not claim identical wire semantics: request-envelope metadata and transport authentication headers are intentionally out of scope here.