---
url: /streams/demos/collaborative-ai-editor.md
description: Collaborative rich text editor where an AI agent is a server-side CRDT peer.
---

# Collaborative AI Editor

Collaborative rich text editor where an AI agent is a server-side CRDT peer. It uses [Durable Streams](/streams/) as the transport layer for both [Yjs](https://yjs.dev) document collaboration and [TanStack AI](https://tanstack.com/ai) chat sessions.

## How it works

The demo is a [TanStack Start](https://tanstack.com/start) app with a [ProseMirror](https://prosemirror.net) / Yjs editor and an AI chat sidebar. Human users and the AI agent connect to the same Durable Streams-backed Yjs document, awareness, and chat streams.

The AI agent, Electra, runs as a server-side Yjs peer. It has its own cursor, presence, and streaming edits, so it can work in the document even when no browser is open. Read the [blog post](/blog/2026/04/08/ai-agents-as-crdt-peers-with-yjs) for more details.

Watch on YouTube: [AI agents as CRDT peers: building a collaborative AI editor with Yjs](https://www.youtube.com/watch?v=qdEIE5XY0wo)
