Configure the AI Transport channel rule
AI Transport streams tokens by appending to a single Ably channel message. That requires one channel rule on the channels your conversations live on. This is a one-time configuration per Ably app.
The Message annotations, updates, deletes, and appends channel rule (mutableMessages: true in the Control API) must be enabled on every channel you use with AI Transport. AI Transport streams each response by appending tokens to a single channel message, and appends only work on channels with this rule enabled.
A channel rule applies to the channels selected by its match expression. Pick a prefix that keeps your conversations separate from other channels in the same app, such as conversations or chat, and enable the rule on the expression conversations:*.
Without the rule, AI Transport fails on the first token append after a stream starts, with error 93002 Can only update/delete/append messages on channels with mutableMessages enabled.
Enable the rule
In your app settings:
- Click Add new rule.
- Enter the match expression selecting the channels on which to enable message updates and deletes, such as
conversations:*. - Check Message annotations, updates, deletes, and appends.
- Click Create rule to save.
Verify the rule applies to your channel names
Segments are matched literally, so the expression has to line up with the channel names you actually publish to. If your conversations live on channel names like conversations:abc-123, the expression conversations:* covers them; conversation:* (singular) does not.
Note that a trailing * needs at least one segment: conversations:* matches conversations:abc-123 but not the bare channel conversations. That's fine here, since AI Transport puts each conversation on its own sub-channel.
The fastest way to check is to send one user message through AI Transport and look in the agent's logs for 93002. If no 93002 appears and the first token streams through, the rule is applied correctly.
Read next
- Set up authentication: the auth setup AI Transport needs alongside the channel rule.
- Troubleshooting: channel rule not configured: what it looks like at runtime when the rule is missing.
- Get started with useView: build a chat app once the rule is configured.