Dosu LogoDosu Logo
Ask
Join our Discord
assistant-ui's SpacePublic
assistant-ui
Documentsassistant-ui's Space
adapters
adapters
Type
External
Status
Published
Created
Mar 17, 2026
Updated
Sep 17, 2026
Updated by
Dosu Bot
Source
apps/docs/content/docs/ink/adapters.mdx

Adapters customize runtime behavior. They can be passed as options to useLocalRuntime or useRemoteThreadListRuntime.

createFileStorageAdapter#

A RemoteThreadListAdapter that persists threads and messages to a local directory. See Custom Backend → Option 2 for usage.

import { createFileStorageAdapter } from "@assistant-ui/react-ink";

const adapter = createFileStorageAdapter({
  dir: "/path/to/threads",
});

Attachment adapters#

SimpleTextAttachmentAdapter and SimpleImageAttachmentAdapter work the same in the terminal as on web and React Native. Text contents are sent to the model wrapped in <attachment name="..."> tags. Ampersands, double quotes, and angle brackets are escaped in the quoted filename; the attachment body remains raw text. Images are sent as base64 data URLs.

import {
  CompositeAttachmentAdapter,
  SimpleImageAttachmentAdapter,
  SimpleTextAttachmentAdapter,
  useLocalRuntime,
} from "@assistant-ui/react-ink";

const runtime = useLocalRuntime(chatModelAdapter, {
  adapters: {
    attachments: new CompositeAttachmentAdapter([
      new SimpleTextAttachmentAdapter(),
      new SimpleImageAttachmentAdapter(),
    ]),
  },
});

TitleGenerationAdapter#

Produces a thread title from a thread's messages. Pass one as the titleGenerator option to createFileStorageAdapter, or call it from a custom RemoteThreadListAdapter.

type TitleGenerationAdapter = {
  generateTitle(messages: readonly ThreadMessage[]): Promise<string>;
};

createSimpleTitleAdapter is the built-in implementation; it derives the title from the first user message, truncated to 50 characters.

import {
  createFileStorageAdapter,
  createSimpleTitleAdapter,
} from "@assistant-ui/react-ink";

const adapter = createFileStorageAdapter({
  dir: "/path/to/threads",
  titleGenerator: createSimpleTitleAdapter(),
});

RemoteThreadListAdapter#

Title generation is configured via the generateTitle method on RemoteThreadListAdapter. See the Custom Backend page for a full example.

import type { RemoteThreadListAdapter } from "@assistant-ui/react-ink";
import { createAssistantStream } from "assistant-stream";

const myAdapter: RemoteThreadListAdapter = {
  // ... other methods ...

  async generateTitle(remoteId, unstable_messages) {
    return createAssistantStream(async (controller) => {
      const res = await fetch(`/api/threads/${remoteId}/title`, {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ messages: unstable_messages }),
      });
      const { title } = await res.json();
      controller.appendText(title);
    });
  },
};

Which option to choose?#

ChatModelAdapter + useLocalRuntimeRemoteThreadListAdapter + useRemoteThreadListRuntime
Thread storageIn-memoryYour backend
Message storageIn-memoryIn-memory (can add history adapter for server-side)
Cross-session persistenceNoYes
Setup complexityMinimalModerate
Best forCLI tools, demos, prototypesProduction apps with persistence
Documents
AG-UI Message History Management
CHANGELOG
CHANGELOG
CHANGELOG
external-store
overview
README
AG-UI Streaming State Management
hooks
index
introduction
overview
part-1
README
README
stockbroker
AI SDK Integration
ai-sdk
assistant-runtime-provider
expo
hooks
index
index
index
introduction
migration
migration
overview
part-2
README
README
README
README
README
README
README
README
stockbroker
Cloud Message Pagination
index
Generative UI Date and Time Controls
In-Memory Thread Lifecycle
CHANGELOG
CHANGELOG
CHANGELOG
Local Runtime Message History
CHANGELOG
Markdown Preprocessing and Repair
CHANGELOG
CHANGELOG
MCP App Tool UI Rendering
CHANGELOG
CHANGELOG
message
MCP OAuth State Management
MessageRepository Branch Pointer Invariant
Next.js Cache Components
Remote Thread List Runtime
adapters
CHANGELOG
CHANGELOG
hooks
index
README
README
thread-runtime
Render Prop Leakage
Run Cancellation and Abort Signal Propagation
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
README
Run Telemetry Model ID Extraction
SSR-Safe Thread ID Generation
Stream Decoder Buffer Limits
CHANGELOG
CHANGELOG
StreamdownTextPrimitive
index
Streaming Markdown Rendering
CHANGELOG
CHANGELOG
index
introduction
part-1
AGENTS
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CODE_OF_CONDUCT
CONTRIBUTING
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README_LANGGRAPH
SECURITY
SPEC
SPEC_AssistantFrame
SPEC_ModelContextRegistry
action-bar
action-bar-more
adapters
artifacts
assistant-if
assistant-modal
assistant-modal
assistant-runtime
assistant-sidebar
attachment
attachment
attachment-runtime
branch-picker
chatgpt
claude
composer
composer-runtime
composition
context-display
custom-backend
custom-backend
error
file
form-demo
grok
heat-graph
hooks
image
index
index
index
index
index
index
index
index
index
markdown
mem0
mermaid
message-part
message-part-runtime
message-runtime
message-timing
modal
model-selector
part-3
perplexity
pick-a-runtime
primitives
primitives
quote
reasoning
selection-toolbar
sources
suggestion
syntax-highlighting
thread
thread
thread-list
thread-list
thread-list-item
thread-list-item-more
thread-list-item-runtime
thread-list-runtime
tool-fallback
tool-group
tw-shimmer
v4-legacy
v5-legacy