Expand description
A2A-compatible event mapping boundary for collaboration transport.
This module defines the CollaborationTransport trait that abstracts the
transport layer for CollaborationEvents, and provides a LocalTransport
implementation backed by an in-process broadcast channel.
§A2A Concept Mapping
The collaboration event model is designed to map cleanly onto the ADK A2A
protocol (see adk-server/src/a2a/types.rs) for future remote specialist
execution. The mapping is:
| Collaboration Concept | A2A Concept |
|---|---|
CollaborationEvent | A2A Message or TaskStatusUpdateEvent |
correlation_id | A2A task_id — links related events into one task |
producer | A2A agent card sender — the agent originating the event |
consumer | A2A agent card receiver — the intended recipient agent |
kind | A2A TaskState or message role (see kind mapping below) |
payload | A2A Artifact parts or Message parts (structured data) |
topic | A2A message metadata or artifact name |
timestamp | A2A event timestamp |
§Event Kind → A2A Task State Mapping
[CollaborationEventKind] | A2A TaskState | Notes |
|---|---|---|
NeedWork | Submitted | A new task is submitted for another agent |
WorkClaimed | Working | The receiving agent has accepted the task |
WorkPublished | Completed + artifact | Task completed with output artifact |
FeedbackRequested | InputRequired | Agent needs input before continuing |
FeedbackProvided | Submitted (response) | Input provided as a new message |
Blocked | InputRequired + metadata | Agent blocked, needs external decision |
Completed | Completed (final) | Terminal state, no more updates |
§Transport Neutrality
Phase 1 uses LocalTransport (in-process broadcast channel). The event
envelope is transport-neutral: the same CollaborationEvent struct works
whether the transport is local or remote. A future A2aTransport would
serialize events into A2A JSON-RPC messages and route them over HTTP/SSE
without changing the CollaborationTransport trait contract.
§Migration Path to A2A
To add remote specialist execution later:
- Implement
CollaborationTransportbacked by an A2A client - Map
CollaborationEvent→ A2AMessageon publish - Map A2A
TaskStatusUpdateEvent/TaskArtifactUpdateEvent→CollaborationEventon receive - Use
correlation_idas the A2Atask_idfor routing - Use
producer/consumerto resolve agent card URLs
The [Workspace] API remains unchanged — only the transport implementation
swaps from local to remote.
§Example
use adk_code::a2a_compat::{CollaborationTransport, LocalTransport};
use adk_code::{CollaborationEvent, CollaborationEventKind};
let transport = LocalTransport::new(64);
let mut receiver = transport.subscribe();
let event = CollaborationEvent::new(
"corr-1", "api-routes", "backend", CollaborationEventKind::WorkPublished,
);
transport.publish(event).await.unwrap();
let received = receiver.recv().await;
assert!(received.is_some());Structs§
- Local
Transport - In-process collaboration transport backed by a
broadcastchannel.
Traits§
- Collaboration
Receiver - Async trait for receiving collaboration events from a transport.
- Collaboration
Transport - Async trait abstracting the collaboration event transport layer.