Description
A2AAgent can send standard A2A message metadata, and RequestContext exposes inbound metadata on the server. However, there is currently no public way to bridge workflow runtime context into that metadata and then initialize the remote Microsoft Agent Framework session before execution.
This is needed when one workflow participant or tool produces structured runtime context and a later A2AAgent participant must send that context to a remote A2A server.
Current behavior
- GroupChat correctly forwards
function_invocation_kwargs to its participants.
A2AAgent.run() accepts function_invocation_kwargs for interface compatibility but does not transmit them over A2A.
A2AAgent already maps Message.additional_properties["a2a_metadata"] to A2A Message.metadata, but callers must construct this message metadata themselves.
A2AExecutor receives the inbound RequestContext, including metadata, but creates the MAF session internally with no hook to initialize session.state before calling the agent.
Desired behavior
Provide explicit, JSON-safe extension points for this flow without automatically serializing arbitrary runtime kwargs or placing application data in HTTP headers.
For example, one possible API would be:
A2AAgent.run(
messages,
a2a_metadata={"context": runtime_context},
)
and a server-side hook such as:
class A2AExecutor:
async def prepare_session(
self,
context: RequestContext,
session: AgentSession,
) -> None:
pass
The server implementation could then do:
session.state["context"] = context.message.metadata.get("context")
Minimal reproduction
runtime_context = {"request_id": "example", "attributes": {"key": "value"}}
await workflow.run(
"Process the request.",
function_invocation_kwargs={"runtime_context": runtime_context},
)
The expected result is that the remote A2A server can retrieve the structured runtime context before invoking the MAF agent.
Proposed scope
- Add a documented outbound A2A metadata mechanism to
A2AAgent.
- Add a documented pre-execution session initialization hook to
A2AExecutor.
- Add focused client and server tests proving metadata is available before remote agent execution.
- Document that only JSON-compatible, explicitly selected application data should be transmitted.
I am happy to contribute the implementation after the API direction is confirmed.
Description
A2AAgentcan send standard A2A message metadata, andRequestContextexposes inbound metadata on the server. However, there is currently no public way to bridge workflow runtime context into that metadata and then initialize the remote Microsoft Agent Framework session before execution.This is needed when one workflow participant or tool produces structured runtime context and a later
A2AAgentparticipant must send that context to a remote A2A server.Current behavior
function_invocation_kwargsto its participants.A2AAgent.run()acceptsfunction_invocation_kwargsfor interface compatibility but does not transmit them over A2A.A2AAgentalready mapsMessage.additional_properties["a2a_metadata"]to A2AMessage.metadata, but callers must construct this message metadata themselves.A2AExecutorreceives the inboundRequestContext, including metadata, but creates the MAF session internally with no hook to initializesession.statebefore calling the agent.Desired behavior
Provide explicit, JSON-safe extension points for this flow without automatically serializing arbitrary runtime kwargs or placing application data in HTTP headers.
For example, one possible API would be:
and a server-side hook such as:
The server implementation could then do:
Minimal reproduction
The expected result is that the remote A2A server can retrieve the structured runtime context before invoking the MAF agent.
Proposed scope
A2AAgent.A2AExecutor.I am happy to contribute the implementation after the API direction is confirmed.