Channel model
- Every message belongs to exactly one channel. Channel
0is the control channel, present in every session and carrying every JSON-RPC message; channels ≥ 1 are the observation and command channels declared in the manifest, assigned theirchannel_idinsession.ready, and carried as frames.[AWP-TRN-005] - Classes.
control: no loss, in order, replayed on resume bystatus_seq, audited in full.reliable: no loss, inseqorder, resumed from a keyframe, audited by hash.latest-wins: droppable, newest wins, audited by hash. A channel’s class is fixed for the life of the manifest.[AWP-TRN-006] - Ordering. Order is guaranteed within a channel and never across channels; the only cross-channel relations are those the specification states explicitly — lockstep advance completion (AWP-TIM-003) and command-channel binding (AWP-CMD-003).
[AWP-TRN-007] - Resumption. On
session.resumethe control channel replays per AWP-CTL-008; the agent re-establishes stream connections from the re-issuedstream_endpoints; on everyreliablechannel the world’s first frame after resumption MUST be a keyframe carrying theresyncflag, and theseqgap it reveals is not a loss (AWP-DAT-009);latest-winschannels continue unchanged, except that in lockstep every per-tick channel restarts with a resync keyframe (AWP-TIM-009). A world closes a session’s stream connections when the session is suspended; until the agent re-establishes them its channels are delivered inline (AWP-TRN-012).[AWP-TRN-008]
Bindings
- The control channel is carried on one control connection per session (AWP-CTL-007); worlds MUST offer the WebSocket binding for it, on which the connection uses the
awpsubprotocol and each JSON-RPC message is one text message. Optional control bindings: stdio (local child processes) and gRPC.[AWP-TRN-001] - Bindings MUST preserve the order of every channel they carry.
[AWP-TRN-002] - Channels ≥ 1 are carried either inline on the control connection or on stream connections negotiated in
session.ready. A stream binding either gives every channel independent flow control or it does not:ws(WebSocket binary messages) no;grpc(HTTP/2 streams) no;webrtc(data channels) yes;webtransport(QUIC streams and datagrams) yes;shm(POSIX shared memory, local) yes.[AWP-TRN-003] - The inline binding — frames as
obs.frameandcmd.framenotifications on the control channel (AWP-DAT-004) — is REQUIRED as the fallback when no other binding is mutually supported and is the default for lockstep sessions.[AWP-TRN-004] - Dependent streams. On a binding without independent flow control, including inline, a
latest-winschannel cannot drop in transit, so the sender MUST hold at most one undelivered frame per such channel and replace it when a newer frame is produced; a channel that stalls MUST NOT delay the control channel or any other channel by more than that one frame.[AWP-TRN-009] - Stream reconnection. If a stream connection is lost while the control connection remains, the agent MAY reconnect to the same endpoint with the session token at any time and the world MUST accept it; grants are unaffected,
reliablechannels restart with a resync keyframe (AWP-DAT-009), and the world reports the outage on affectedreliablechannels throughchannel_degraded(AWP-SAF-009). Until it reconnects, the channels that connection carried are not delivered at all, in either direction — not inline — so an agent that lost a stream learns so from the event rather than from a silent change of path.[AWP-TRN-010] - Moving a channel. A channel is delivered inline until a stream connection that carries it is established, and from then on only on that connection. An endpoint that omits
channelscarries every channel of the session, observation and command, including channels subscribed later. The world’s first frame of each observation channel on a newly established stream connection MUST be a keyframe carrying theresyncflag. Because order across connections is not preserved (AWP-TRN-007), an inline frame may arrive after a newer frame of its channel on the stream connection; a receiver MUST discard a frame whoseseqis not greater than the last it processed on that channel when the two arrived on different connections, and MUST NOT count it as loss or report it as a violation.[AWP-TRN-012] - Stream connections. A stream connection is opened against an endpoint URL with the session token as its bearer credential (AWP-SEC-004..006) and the
awpsubprotocol. On thewsbinding every WebSocket message is binary and carries exactly one frame in the binary envelope, world→agent for observation channels and agent→world for command channels; text messages MUST NOT be sent, and a receiver MUST close a stream connection on which a message is not a valid frame (AWP-DAT-010), with WebSocket close code 1002 and reasonAWP_MALFORMED. A token that names no session with a live control connection fails the stream connection.[AWP-TRN-013] - Frame size. Each stream endpoint MAY declare
max_frame_bytes(default 16 MiB); senders MUST NOT emit a larger frame on it, and a world MUST NOT assign a channel to an endpoint that cannot carry that channel’s largest declared frame. Onwebtransport, frames that exceed the datagram limit travel on a stream.[AWP-TRN-011]
AWP assumes the agent and the world share a network environment — the same machine or a trusted local network (an agent client in a browser tab beside a world simulator, a policy process beside a robot controller). Rendezvous across the public internet is out of scope; deployments that separate the two front the world with their own tunnel or proxy presenting a dialable endpoint.