Protobuf
Wire format — AgentMessage, RpcRequest, RpcResponse.
All messages use protobuf encoding. Definitions live in subway-proto/proto/.
AgentMessage#
The envelope for all direct messages and broadcasts.
message AgentMessage {
string message_id = 1;
string sender_peer_id = 2;
string sender_name = 3;
uint64 timestamp_ms = 4;
string message_type = 5;
bytes payload = 6;
map<string, string> metadata = 7;
}| Field | Description |
|---|---|
message_id | UUID v4, auto-generated by new_agent_message() |
sender_peer_id | Sender's libp2p PeerId string |
sender_name | Human-readable name (e.g., worker.relay) |
timestamp_ms | Unix milliseconds at creation |
message_type | Application-defined tag (e.g., "task", "metric") |
payload | Arbitrary bytes |
metadata | String key-value map. broadcast_topic used for pub/sub routing. |
RpcRequest#
message RpcRequest {
string correlation_id = 1;
string method = 2;
bytes payload = 3;
map<string, string> metadata = 4;
}| Field | Description |
|---|---|
correlation_id | Links request to response (UUID) |
method | RPC method name |
payload | Request body |
metadata | Key-value metadata |
RpcResponse#
message RpcResponse {
string correlation_id = 1;
bool success = 2;
bytes payload = 3;
string error = 4;
}| Field | Description |
|---|---|
correlation_id | Matches the request |
success | true if handled successfully |
payload | Response body |
error | Error message (empty on success) |
PresenceAnnouncement#
message PresenceAnnouncement {
string peer_id = 1;
string agent_name = 2;
string status = 3;
uint64 timestamp_ms = 4;
map<string, string> capabilities = 5;
}ℹInfo
PresenceAnnouncement is defined but not yet wired into the runtime. It's reserved for future capability discovery.