Repository navigation
Python: A2AAgent: forward selected run kwargs in request metadata #7973
Description
Activity
- addedpythonUsage: [Issues, PRs], Target: PythonUsage: [Issues, PRs], Target: PythontriageUsage: [Issues], Target: All issues that still need to be triagedUsage: [Issues], Target: All issues that still need to be triaged
on Aug 31, 2026 Thanks for the detailed reproduction. I verified the current
mainpath:A2AAgent._prepare_message_for_a2a()already copies the explicitMessage.additional_properties["a2a_metadata"]mapping to the outbound A2A message, whileA2AExecutor.execute()creates the session immediately before_run()/_run_stream()and has no pre-execution hook. I also found no open PR or commit linked to #7973.I can contribute the smallest focused implementation once the API direction is confirmed. My proposed slice is:
- Keep arbitrary
function_invocation_kwargsout of transport. Add an explicit, JSON-safea2a_metadatainput at the A2AAgent boundary (or document/reuse the existing message-levela2a_metadatapath if maintainers prefer), and cover both regular and streaming sends without changing unrelated headers. - Add an awaited
A2AExecutorsession-preparation extension point that runs aftercreate_session(...)and before_run/_run_stream, receiving the inboundRequestContextand newly-createdAgentSession. The default remains a no-op, so existing users are unaffected. - Add focused unit tests proving that selected metadata arrives at the remote A2A message and that the hook can populate session state before agent execution, including the streaming path where applicable.
Could a maintainer confirm the preferred public API/signature and whether this issue should be assigned to me for implementation? I will keep the change limited to the Python A2A package and its tests, and document that only explicitly selected JSON-compatible application data is transmitted.
- Keep arbitrary
- addeda2aUsage: [Issues, PRs], Target: A2AUsage: [Issues, PRs], Target: A2Aand removedtriageUsage: [Issues], Target: All issues that still need to be triagedUsage: [Issues], Target: All issues that still need to be triaged
on Aug 31, 2026 - changed the title
[-]Python: Add A2A metadata hooks for cross-agent runtime context[/-][+]Python: A2AAgent: send request metadata over A2A from client_kwargs[/+]on Oct 8, 2026 - changed the title
[-]Python: A2AAgent: send request metadata over A2A from client_kwargs[/-][+]Python: A2AAgent: forward selected run kwargs over A2A request metadata[/+]on Oct 8, 2026 - changed the title
[-]Python: A2AAgent: forward selected run kwargs over A2A request metadata[/-][+]Python: A2AAgent: forward selected run kwargs in request metadata[/+]on Oct 8, 2026
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNo status
Description
A2AAgent.run()acceptsfunction_invocation_kwargsandclient_kwargsfor interface compatibility but sends nothing over A2A. When anA2AAgentis a workflow participant, the runtime context a caller passes throughworkflow.run(function_invocation_kwargs=..., client_kwargs=...)never reaches the remote A2A server, so a remote agent behaves differently from a local one.These two kwargs, together with
session,streamand the messages, are the wholeSupportsAgentRun.runcontract, so they are the natural carrier. The A2A protocol has a request-levelSendMessageRequest.metadatafield (aStruct, exposed server-side asRequestContext.metadata) thatA2AAgentnever sets and that is not part of the message or task history.Proposal
Let an
A2AAgentopt in to forwarding selected keys of those two kwargs, sent asSendMessageRequest.metadata["agent_framework"] = {"function_invocation_kwargs": {...}, "client_kwargs": {...}}:A2AAgent(..., forwarded_kwargs=[...])). Nothing is sent by default, so credentials or other local objects in kwargs are never serialized to a remote service.Structcan carry exactly (JSON-compatible, finite numbers, integers within +/-2**53), with a clear error otherwise.Message.metadata.workflow.run(...), including per-executor targeting.The server side is tracked in #9191.
Code Sample
Language/SDK
Python