Skip to content

feat: Propagate A2A request metadata to InvocationContext #3098

@ufJmacca

Description

@ufJmacca

Is your feature request related to a problem?

Currently, when an A2A request is made to an ADK agent, the metadata associated with the A2A request is not propagated to the InvocationContext. This makes it difficult to implement end-to-end traceability in a distributed multi-agent system, as there is no way to access the A2A request metadata from within the agent's execution context.

Describe the solution you'd like

The A2A request metadata should be accessible as an element of the InvocationContext. This would allow developers to access the metadata within their agents and tools, enabling them to implement custom logic based on the metadata, such as routing requests, applying specific policies, or adding traceability information to logs and metrics.

This can be achieved by:

  1. Adding a metadata field to the RunConfig class.
  2. Updating the convert_a2a_request_to_adk_run_args function to extract the metadata from the RequestContext and place it into the RunConfig.
  3. Adding an a2a_metadata field to the InvocationContext class.
  4. Modifying the _new_invocation_context method in the Runner to transfer the metadata from the RunConfig to the newly created InvocationContext.

Testing plan

Perform manual end to end testing

Additional context

This change is essential for building robust, traceable, and observable multi-agent systems with ADK, especially when integrating with other systems via the A2A protocol.

Metadata

Metadata

Assignees

Labels

bot triaged[Bot] This issue is triaged by ADK bottracing[Component] This issue is related to OpenTelemetry tracing

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions