Relay Transport • AI Agent SDK
RelayTransport: Protocol for an out-of-process platform-connector relay.
RelayTransport
Defined in the protocols module.
AI Agent
Protocol for an out-of-process platform-connector relay.
A concrete implementation (e.g. a `WebSocketRelayTransport in the praisonai wrapper) lets a connector that holds the platform socket forward normalised inbound :class:GatewayMessage` events to the gateway and accept outbound sends/interrupts back down. The gateway treats the relay like any other adapter (same inbound routing, admission control, delivery) but the connection lives elsewhere.
Lifecycle::
caps = await transport.connect() # handshake → capabilities transport.set_inbound_handler(on_message) # wire inbound events in … # events relayed in/out await transport.go_dormant() # pause, keep connection await transport.disconnect() # tear down
Methods
Establish the relay and complete the handshake.
set_inbound_handler()Register the coroutine invoked for each relayed inbound message.
send_outbound()Relay an outbound message to `target` via the connector.
Pause inbound dispatch without dropping the connection.
disconnect()Tear down the relay connection.
Source
View on GitHubpraisonaiagents/gateway/protocols.py at line 6645