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;
}
FieldDescription
message_idUUID v4, auto-generated by new_agent_message()
sender_peer_idSender's libp2p PeerId string
sender_nameHuman-readable name (e.g., worker.relay)
timestamp_msUnix milliseconds at creation
message_typeApplication-defined tag (e.g., "task", "metric")
payloadArbitrary bytes
metadataString 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;
}
FieldDescription
correlation_idLinks request to response (UUID)
methodRPC method name
payloadRequest body
metadataKey-value metadata

RpcResponse#

message RpcResponse {
  string correlation_id = 1;
  bool success = 2;
  bytes payload = 3;
  string error = 4;
}
FieldDescription
correlation_idMatches the request
successtrue if handled successfully
payloadResponse body
errorError 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.