Quick Start
1
In-Process (Default — No Change Needed)
Without a relay transport, the bot adapter runs in the same process as the gateway. This is the default and requires no extra config:
2
Out-of-Process via Relay Transport
Pass a
transport= to the Bot constructor to use a remote connector. The transport= parameter is optional and backward-compatible:The relay path opts out of
Bot-level supervision automatically because the transport owns reconnect and scale-to-zero dormancy — you never need to set enable_supervision=False yourself. See Auto-reconnect on long-running-bots.3
Implement a custom RelayTransport
4
Enable scale-to-zero
5
CLI Gateway with Relay
How It Works
At handshake time the connector attests aCapabilityDescriptor — the gateway uses this to adapt streaming, markdown, and message-length behaviour to the actual platform being fronted, even though it never touches the platform socket directly.
CapabilityDescriptor Fields
The connector attests these capabilities at handshake time:
RelayTransport Protocol
Implement these methods to create a custom transport:
When to Use a Relay
Scale-to-Zero with go_dormant()
When the gateway scales to zero, call go_dormant() to pause inbound dispatch:
Best Practices
Use go_dormant() during scale-to-zero, not disconnect()
Use go_dormant() during scale-to-zero, not disconnect()
disconnect() tears down the connection and the connector stops buffering. go_dormant() keeps the connector alive and buffering, so events that arrive while the gateway is sleeping are drained on wake.Capability negotiation at handshake
Capability negotiation at handshake
Always use the
CapabilityDescriptor returned by connect() to configure your delivery layer. Never hard-code platform limits — the connector is the authority on what the actual platform supports.The transport= parameter is optional
The transport= parameter is optional
Omit
transport= entirely to keep the existing in-process behaviour. No existing code needs to change; just add the parameter when you need an out-of-process connector.Related
Gateway Overview
How the gateway connects agents to channels
Gateway Scale-to-Zero
Idle dormancy and wake-up behaviour
Durable Outbound Delivery
Retry and DLQ for all channels
Multi-Channel Bots
One gateway, many platforms

