Skip to content

jldec/agents-chat

Repository files navigation

Multi-user AI Chat with RedwoodSDK RSC and Cloudflare Agents

This is an experimental project, looking at how to live-stream AI responses back to multiple connected clients. All implementations use Cloudflare durable objects and React Server Components (RSC) with RedwoodSDK.

This is a companion repository for a blog post, deployed at https://agents-chat.jldec.me/.

Implementations

  1. RSC Chat - Uses RedwoodSDK realtime websockets
  2. Agent Chat - Uses Cloudflare Agents websockets with separate durable object storage
  3. Agent SDK Chat - Uses Cloudflare Agents AIChatAgent with the useAgentChat hook
  4. TinyBase Chat - Uses TinyBase websockets
  5. Agent Agent Chat - Advanced Cloudflare agent with subagents and MCP tool calling

Takeaways

RedwoodSDK RSC:

  • Server components provide succinct way to populate JSX and keep clients updated.
  • This makes using react with Cloudflar workers super easy, and simplifies async data loading.

Cloudflare Agents:

  • AIChatAgent provides its own websocket protocol for multi-user real-time sync
  • Agents also offer raw websockets give full control over payloads for optimizations
  • Vercel's AI SDK abstracts tool calling and supports different LLMs

TinyBase:

  • DB sync engines can improve UX with local-first client-side persistence
  • The approach requires careful validation since database operations run on the client

Links

About

https://agents-chat.jldec.me/

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published