Cloudflare Agents
Keep the Agent connection and durable chat lifecycle with Cloudflare’s native hook.
Bind the existing connection
Install agents@0.32.0 and @cloudflare/ai-chat@0.12.2 plus their native peers. Configure a server-side chat Agent with Cloudflare's chat guidance. Ghost reads the client hook; it does not create a Durable Object or websocket transport.
isStreaming includes server-pushed continuations; isRecovering reports a durable turn being restored. Using only the underlying AI SDK status would miss those states. The native stop implementation also aborts tool continuations; retain it when binding the hook. Compose input/actions with runtime.controller and inspect current capabilities.
Server state and tools
Cloudflare owns websocket connection/recovery, durable turns and native message synchronization. Read application Agent state through the native connection and validate it for your UI. Browser tool callbacks and addToolOutput are application execution paths; do not connect arbitrary tool data to privileged execution. Approval acknowledgement remains distinct from a tool result.
Troubleshooting
A frozen-looking conversation may be recovering rather than streaming. A server continuation can be busy while the client request is idle. Keep the hook's connection error and native lifecycle fields, and replace the owner when changing thread identity. Use Message/Composer docs for appearance rather than adding Cloudflare-specific visual variants.