Add An Attached Stream
Outcome
Section titled “Outcome”You can register an attached stream handler and expose live output through the Cloudflare DO facade.
Prerequisites
Section titled “Prerequisites”- Define an
AttachedStreamHandlerin app code. - Choose
mode: "bidi"for WebSocket ormode: "output_only"for SSE. - Choose
cancellationandonDetachexplicitly. - Yield
outputorprogressframes fromrun. - Yield one terminal frame and write durable facts in
commitTerminal. - Register the handler with
defineAgentDO({ streams: [handler] }).