# assistant-ui

> The UX of ChatGPT as composable React primitives

- Category: App UIs & Builders / Generative UI SDKs
- Language: TypeScript
- Repository: https://github.com/assistant-ui/assistant-ui
- Website: https://www.assistant-ui.com
- Canonical page: https://ai-tldr.dev/tools/assistant-ui/

## In short

assistant-ui is an open-source TypeScript/React library for building AI chat interfaces. It sits in the Generative UI SDKs category of the App UIs & Builders tools and is open-source, written in TypeScript. To get started: scaffold or add to a project with the CLI.

## Overview

assistant-ui is an open-source TypeScript/React library for building AI chat interfaces. Instead of one monolithic chat widget, it gives you composable primitives such as Thread, Message, Composer, ThreadList, and ActionBar that you arrange and style yourself, so the look and behavior match your own app.

It targets React and Next.js developers who want a ChatGPT-style experience without building streaming, auto-scroll, retries, attachments, markdown, and accessibility from scratch. A CLI can scaffold a new Next.js project or add styled shadcn/ui components to an existing one.

As a generative UI SDK, it can render tool calls and JSON as interactive React components, collect inline human approvals, and connect to many backends through runtime adapters for the Vercel AI SDK, LangGraph/LangChain, and custom HTTP services.

## What it does

- Composable primitives (Thread, Message, Composer, ThreadList, ActionBar) you style yourself or via a shadcn/ui starter theme
- Production chat UX built in: streaming, auto-scroll, retries, attachments, markdown, code highlighting, voice dictation, keyboard shortcuts, and accessibility
- Generative UI: render tool calls and JSON as React components, collect inline human approvals, and expose safe frontend actions to the model
- Runtime adapters for the Vercel AI SDK, LangGraph/LangChain, AG-UI/A2A, Google ADK, and custom data-stream backends
- Broad model support out of the box including OpenAI, Anthropic, Google Gemini, Mistral, AWS Bedrock, Azure, and Ollama via the AI SDK
- End-to-end TypeScript for runtime APIs, tool schemas, message parts, and adapters

## Getting started

The fastest path is the CLI, which scaffolds a Next.js app or adds the styled components to an existing project. You can also install the packages directly and wire up a runtime.

1. Scaffold or add to a project with the CLI

   Create a new project, or run init to add the styled components to an existing app.

```bash
npx assistant-ui@latest create   # new project
npx assistant-ui@latest init     # add to existing project
```

2. Or install the packages directly

   Install the core library plus the Vercel AI SDK runtime adapter.

```bash
npm install @assistant-ui/react @assistant-ui/react-ai-sdk
```

3. Render a chat

   Wrap your Thread in AssistantRuntimeProvider with a runtime. useChatRuntime connects to the Vercel AI SDK out of the box; swap it for useLangGraphRuntime, useDataStreamRuntime, or a custom runtime for your own backend.

```ts
"use client";

import { AssistantRuntimeProvider } from "@assistant-ui/react";
import { useChatRuntime } from "@assistant-ui/react-ai-sdk";
import { Thread } from "@/components/assistant-ui/thread";

export function Chat() {
  const runtime = useChatRuntime();
  return (
    <AssistantRuntimeProvider runtime={runtime}>
      <Thread />
    </AssistantRuntimeProvider>
  );
}
```

## When to use it

- Add a ChatGPT-style assistant to a Next.js or React app without rebuilding streaming, retries, and accessibility
- Build a generative UI where tool calls and JSON responses render as interactive React components with inline human approvals
- Put a custom chat front end on a LangGraph, LangChain, or Vercel AI SDK backend through a runtime adapter
- Match a chat interface to your own design system by composing primitives and bringing your own styles
