A thread is one conversation. A thread list holds many, and you choose where they are kept: in memory, in the browser, in Assistant Cloud, or in your own database.
A thread is one conversation: its messages, its composer and the run in progress. Until you give it somewhere to keep threads, a runtime holds a single thread in memory, so a reload starts a new conversation.
A thread list is what lets a user come back. It holds many threads, switches between them, starts new ones, and renames, archives or deletes old ones. The runtime keeps the open thread and the list in step. What you choose is where the threads are kept.
Each item in the list has an id and a status, and, once they are known, a title and the time of its last message. The status is regular, archived, or new for a thread the user has opened but not yet sent anything in. When threads are stored, a new thread is written to storage when its first message is sent, so opening an empty chat and leaving it stores nothing.
Try it below. The thread list is backed by a RemoteThreadListAdapter that keeps its rows in memory, and the panel under the chat shows what the adapter stores and the latest calls the runtime made to it. Start a new thread and leave it empty, send a message, then rename, archive or delete a thread from its menu.
The thread table your RemoteThreadListAdapter writes, and how many messages its history adapter saved for each thread.
| remoteId | status | title | messages |
|---|---|---|---|
| Empty. A thread is stored when its first message is sent. | |||
Where threads are kept
| Where | What you get | What you write |
|---|---|---|
| In memory (the default) | One thread that resets on reload | Nothing |
| A history adapter | One thread that survives a reload | Load and append for messages |
| Assistant Cloud | A full thread list with titles, stored in the cloud | Nothing beyond passing cloud |
| The browser | A full thread list in localStorage, for prototypes and single-user apps | A small storage wrapper |
| Your own database | A full thread list in tables you own | A RemoteThreadListAdapter |
| Your own store | A thread list that lives next to your messages in Redux, Zustand or similar | An ExternalStoreThreadListAdapter |
Assistant Cloud
Pass an AssistantCloud instance to your runtime and the thread list, titles and syncing are handled for you:
import { useLocalRuntime } from "@assistant-ui/react";
import { AssistantCloud } from "assistant-cloud";
const cloud = new AssistantCloud({
baseUrl: process.env.NEXT_PUBLIC_ASSISTANT_BASE_URL!,
anonymous: true,
});
function useMyRuntime() {
return useLocalRuntime(modelAdapter, { cloud });
}Most framework runtimes take cloud the same way, for example useChatRuntime({ cloud }); AG-UI and A2A go through useCloudThreadListRuntime instead. Where the messages themselves are stored depends on the runtime: useLocalRuntime and the AI SDK runtime keep them in the cloud, while runtimes whose backend already keeps the transcript, such as LangGraph, load it from that backend and store a copy in the cloud for the dashboard. Which runtime lists each one.
Your own database
useRemoteThreadListRuntime wraps any runtime hook and asks a RemoteThreadListAdapter you write to list, create, rename, archive and delete threads. With runtimes that take a history adapter, the messages of each thread are saved through it; runtimes whose backend keeps the transcript load it from there. You keep every row in your own database, next to the rest of your app's data.
Thread list adapters describes the contract and the cases a production list has to handle, such as the first message racing thread creation, and custom thread persistence builds one with Postgres.
The browser
createLocalStorageAdapter from @assistant-ui/core/react is a ready-made RemoteThreadListAdapter that keeps the thread list and every thread's messages in a key-value store you hand it. Give it localStorage and createSimpleTitleAdapter, which titles each thread with its first message:
"use client";
import { useChatRuntime } from "@assistant-ui/ai-sdk";
import {
createLocalStorageAdapter,
createSimpleTitleAdapter,
} from "@assistant-ui/core/react";
import {
AssistantRuntimeProvider,
useRemoteThreadListRuntime,
} from "@assistant-ui/react";
import { ThreadList } from "@/components/assistant-ui/elements/thread-list.aui";
import { Thread } from "@/components/assistant-ui/elements/thread.aui";
// Next.js also renders this component on the server, where there is no localStorage.
const inBrowser = () => typeof window !== "undefined";
const threads = createLocalStorageAdapter({
storage: {
getItem: async (key) => (inBrowser() ? localStorage.getItem(key) : null),
setItem: async (key, value) => {
if (inBrowser()) localStorage.setItem(key, value);
},
removeItem: async (key) => {
if (inBrowser()) localStorage.removeItem(key);
},
},
titleGenerator: createSimpleTitleAdapter(),
});
export function Assistant() {
const runtime = useRemoteThreadListRuntime({
adapter: threads,
runtimeHook: function useThreadRuntime() {
return useChatRuntime();
},
});
return (
<AssistantRuntimeProvider runtime={runtime}>
<ThreadList />
<Thread />
</AssistantRuntimeProvider>
);
}Install @assistant-ui/core next to @assistant-ui/react. Writes are ordered within one tab only, so two tabs writing at once can lose a thread; move to your own database before more than one tab or device shares the list.
Your own store
If your app already keeps its messages in a store and uses ExternalStoreRuntime, the threads can live there too. An ExternalStoreThreadListAdapter hands the runtime the current thread id and the list, and your callbacks switch, rename, archive and delete. See thread list adapters.
Choosing
Ask three questions in order:
- Do you want it managed? Use Assistant Cloud. You write no database code.
- Do you have your own backend? Use
useRemoteThreadListRuntimearound your runtime hook. You implement the adapter and own the data. - Are you on
ExternalStoreRuntime? UseExternalStoreThreadListAdapter. Threads live in your store next to the messages.
To show the list on screen, use the ThreadList element or build your own from the ThreadList primitive.