Description
A2AAgent.run() accepts a session: AgentSession | None parameter but never uses it. The _prepare_message_for_a2a method creates an A2AMessage without setting context_id, so the a2a-sdk client auto-generates a new random context_id for every call.
This means:
- No session continuity - The server cannot correlate multiple calls belonging to the same conversation.
-
- No multi-workflow isolation - When multiple orchestrations run concurrently against the same A2A agent server, the single shared
AgentExecutor instance has no stable key to separate their conversation histories.
Expected Behavior
When an AgentSession is provided to A2AAgent.run(), the session's session_id should be mapped to the A2A protocol's Message.context_id field. This would:
- Allow the server-side executor to key conversation history by
context_id.
- Enable concurrent multi-agent workflows to run against the same agent server without cross-contaminating conversation state.
Current Behavior
In _agent.py, line ~265:
normalized_messages = normalize_messages(messages)
a2a_message = self._prepare_message_for_a2a(normalized_messages[-1])
a2a_stream = self.client.send_message(a2a_message)
The session parameter is not referenced. The A2AMessage is created without context_id, so the SDK generates a random UUID per call.
Reproduction
- Create a GroupChat with multiple A2A agent participants.
- Run two workflows concurrently against the same agent servers.
- Observe that
context_id is different on every A2A call (even within the same workflow), and the server-side executor has no way to isolate conversation histories.
Suggested Fix
In _prepare_message_for_a2a, propagate the session ID:
def _prepare_message_for_a2a(self, message: Message) -> A2AMessage:
# ... existing logic ...
return A2AMessage(
role=A2ARole("user"),
parts=parts,
message_id=message.message_id or uuid.uuid4().hex,
context_id=self._current_session_id, # from session passed to run()
metadata=metadata,
)
Workaround
We currently subclass A2AAgent to override _prepare_message_for_a2a and inject a stable context_id (UUID assigned at construction time), and key the server-side executor history by context_id.
Environment
agent-framework-a2a==1.0.0b260304
a2a-sdk (latest)
- Python 3.12
Description
A2AAgent.run()accepts asession: AgentSession | Noneparameter but never uses it. The_prepare_message_for_a2amethod creates anA2AMessagewithout settingcontext_id, so the a2a-sdk client auto-generates a new randomcontext_idfor every call.This means:
AgentExecutorinstance has no stable key to separate their conversation histories.Expected Behavior
When an
AgentSessionis provided toA2AAgent.run(), the session'ssession_idshould be mapped to the A2A protocol'sMessage.context_idfield. This would:context_id.Current Behavior
In
_agent.py, line ~265:The
sessionparameter is not referenced. TheA2AMessageis created withoutcontext_id, so the SDK generates a random UUID per call.Reproduction
context_idis different on every A2A call (even within the same workflow), and the server-side executor has no way to isolate conversation histories.Suggested Fix
In
_prepare_message_for_a2a, propagate the session ID:Workaround
We currently subclass
A2AAgentto override_prepare_message_for_a2aand inject a stablecontext_id(UUID assigned at construction time), and key the server-side executor history bycontext_id.Environment
agent-framework-a2a==1.0.0b260304a2a-sdk(latest)