---
name: assistant-ui
description: "Overview and router for assistant-ui, the React library for building AI chat interfaces from composable primitives and a styled elements catalog. Use for high-level, cross-cutting, or architecture questions: choosing packages, picking a runtime, or understanding the layers (elements, primitives, the aui client with AuiConfig and AuiProvider, the runtime, adapters) and the message model. Covers `@assistant-ui/react` 0.15.x, `@assistant-ui/ai-sdk` for AI SDK v7 (`useChatRuntime`), `@assistant-ui/core`, `@assistant-ui/store`, `assistant-stream`, `assistant-cloud`, the LangGraph, LangChain, Google ADK, A2A, AG-UI, Eve, OpenCode, and Pi adapters, the `@assistant-ui/react-native` and `@assistant-ui/react-ink` bindings, and the `useAui`, `useAuiState`, and `useAuiEvent` hooks. For a specific area route to a focused sibling instead: setup, elements, primitives, runtime, tools, generative-ui, streaming, cloud, thread-list, copilots, markdown, react-mcp, observability, react-native, ink, or update."
license: MIT
title: assistant-ui
canonical_url: https://skilld.dev/gh/assistant-ui/skills/assistant-ui
last_updated: 2026-09-28T23:19:31.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [references/architecture.md](https://skilld.dev/api/skills-raw/assistant-ui/skills/assistant-ui/references/architecture.md), [references/packages.md](https://skilld.dev/api/skills-raw/assistant-ui/skills/assistant-ui/references/packages.md).
>
> If the user asked to install this Skill, run `npx skilld install assistant-ui/skills/assistant-ui`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/assistant-ui`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/assistant-ui/skills/assistant-ui) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/assistant-ui`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/assistant-ui --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/assistant-ui --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# assistant-ui

**Always consult [assistant-ui.com/llms.txt](https://www.assistant-ui.com/llms.txt) for the latest API.**

React library for AI chat interfaces: unstyled primitives, a styled elements catalog, a runtime that adapts any backend, and optional cloud persistence. Current line is `@assistant-ui/react` 0.15.x on AI SDK v7 through `@assistant-ui/ai-sdk`.

## References

- [./references/architecture.md](https://skilld.dev/api/skills-raw/assistant-ui/skills/assistant-ui/references/architecture.md) -- layers, the aui client, data flow, message model
- [./references/packages.md](https://skilld.dev/api/skills-raw/assistant-ui/skills/assistant-ui/references/packages.md) -- every published package and when to install it

## When to Use

| Use Case | Reach for |
|----------|-----------|
| Chat UI in an afternoon | `npx assistant-ui@latest create`, then the `thread` element |
| Full control over markup | Primitives (`ThreadPrimitive`, `ComposerPrimitive`, `MessagePrimitive`) |
| Existing AI backend | A runtime adapter (AI SDK, LangGraph, LangChain, ADK, A2A, AG-UI, Eve, OpenCode) or `useLocalRuntime` |
| Tools with UI | `"use generative"` toolkits, tool UI, generative UI |
| Multi-thread apps | Thread list elements plus Assistant Cloud or your own adapter |
| Copilots in an app | Instructions, context, visible components, interactables |
| Mobile or terminal | `@assistant-ui/react-native`, `@assistant-ui/react-ink` |

## Architecture

```
┌──────────────────────────────────────────────────────────────┐
│  Elements (styled, copied into components/assistant-ui/)     │
│  Primitives (unstyled, @assistant-ui/react)                  │
└───────────────────────────┬──────────────────────────────────┘
                            │ read state, call actions
┌───────────────────────────▼──────────────────────────────────┐
│  aui client: useAui, useAuiState, useAuiEvent, AuiIf         │
│  scopes provided by AuiConfig through AssistantRuntimeProvider│
│  or AuiProvider (@assistant-ui/store on @assistant-ui/tap)   │
└───────────────────────────┬──────────────────────────────────┘
                            │
┌───────────────────────────▼──────────────────────────────────┐
│  Runtime: AssistantRuntime → ThreadRuntime → MessageRuntime  │
│  (@assistant-ui/core, framework neutral)                     │
└───────────────────────────┬──────────────────────────────────┘
                            │
┌───────────────────────────▼──────────────────────────────────┐
│  Adapters and backends: AI SDK · LangGraph · LangChain · ADK │
│  A2A · AG-UI · Eve · OpenCode · custom · Assistant Cloud     │
└──────────────────────────────────────────────────────────────┘
```

## Pick a Runtime

```
Vercel AI SDK?
├─ Yes → useChatRuntime from @assistant-ui/ai-sdk (recommended)
└─ No
   ├─ LangGraph server → useLangGraphRuntime (@assistant-ui/react-langgraph)
   ├─ LangChain / LangGraph useStream → useStreamRuntime (@assistant-ui/react-langchain)
   ├─ Google ADK → useAdkRuntime (@assistant-ui/react-google-adk)
   ├─ A2A protocol → useA2ARuntime (@assistant-ui/react-a2a)
   ├─ AG-UI protocol → useAgUiRuntime (@assistant-ui/react-ag-ui)
   ├─ Eve agents → useEveAgentRuntime (@assistant-ui/eve)
   ├─ OpenCode → useOpenCodeRuntime (@assistant-ui/react-opencode)
   ├─ Claude Managed Agents → useExternalStoreRuntime + useRemoteThreadListRuntime
   ├─ State already in Redux/Zustand/your store → useExternalStoreRuntime
   ├─ Custom endpoint speaking Assistant Transport → useAssistantTransportRuntime
   └─ Any other custom API → useLocalRuntime with a ChatModelAdapter
```

## Core Packages

| Package | Purpose |
|---------|---------|
| `@assistant-ui/react` | Primitives, hooks, runtimes, provider |
| `@assistant-ui/ai-sdk` | AI SDK v7 integration (`useChatRuntime`, `AssistantChatTransport`, `AISDKToolkit`, `frontendTools`) |
| `@assistant-ui/core` | Framework-neutral runtime shared by React, React Native, Ink |
| `@assistant-ui/store` | `AuiConfig`, `AuiProvider`, `useAui` state layer |
| `@assistant-ui/react-markdown` | Markdown rendering (`MarkdownTextPrimitive`) |
| `assistant-stream` | Streaming protocol, encoders, resumable streams |
| `assistant-cloud` | Assistant Cloud client |
| `assistant-ui` | The CLI (`create`, `init`, `add`, `update`, `upgrade`, `doctor`, `mcp`, `agent`) |

`@assistant-ui/react-ai-sdk` re-exports `@assistant-ui/ai-sdk` for older installs; new code imports from `@assistant-ui/ai-sdk`. Styled components are not a package: `npx assistant-ui@latest add thread` copies them into `components/assistant-ui/elements/`. See [./references/packages.md](https://skilld.dev/api/skills-raw/assistant-ui/skills/assistant-ui/references/packages.md) for the full inventory.

## Quick Start

```tsx
"use client";

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

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

`useChatRuntime()` posts to `/api/chat` through `AssistantChatTransport`, which also forwards frontend tools and system instructions. Pass `new AssistantChatTransport({ api })` to change the endpoint.

## State Access

Scope accessors on `aui` are properties; methods on a scope keep their parentheses. Selectors return one primitive or stable reference each.

```tsx
import { useAui, useAuiState, useAuiEvent } from "@assistant-ui/react";

const aui = useAui();
aui.thread.append({ role: "user", content: [{ type: "text", text: "Hi" }] });
aui.thread.cancelRun();
aui.thread.composer().send();
aui.threads.switchToNewThread();

const messages = useAuiState((s) => s.thread.messages);
const isRunning = useAuiState((s) => s.thread.isRunning);

useAuiEvent("threads.selectionChanged", ({ threadId, previousThreadId }) => {});
```

## Providing Scopes

Tools, suggestions, interactables, MCP managers, and other scopes are declared with `AuiConfig` and handed to the provider; `useAui()` takes no arguments.

```tsx
import { AssistantRuntimeProvider, AuiConfig, Suggestions, Tools } from "@assistant-ui/react";
import { useChatRuntime } from "@assistant-ui/ai-sdk";
import toolkit from "./toolkit";

const runtime = useChatRuntime();
const config = AuiConfig({
  tools: Tools({ toolkit }),
  suggestions: Suggestions(["What can you do?", "Summarize this page"]),
});

<AssistantRuntimeProvider runtime={runtime} config={config}>{children}</AssistantRuntimeProvider>;
```

Nested scopes use `<AuiProvider extends={useAui()} config={config}>`; an isolated root uses `extends={null}`.

## Related Skills

- [setup](../setup/SKILL.md) -- CLI, templates, runtime adapters, platforms
- [elements](../elements/SKILL.md) -- the styled component catalog and how to install and override it
- [primitives](../primitives/SKILL.md) -- unstyled building blocks and composer features
- [runtime](../runtime/SKILL.md) -- runtimes, the aui client, adapters, events
- [tools](../tools/SKILL.md) -- toolkits, tool UI, approvals, MCP, WebMCP
- [generative-ui](../generative-ui/SKILL.md) -- the `present` tool and component vocabularies
- [streaming](../streaming/SKILL.md) -- assistant-stream, transports, resumable streams
- [cloud](../cloud/SKILL.md) -- Assistant Cloud persistence and auth
- [thread-list](../thread-list/SKILL.md) -- multi-thread management
- [copilots](../copilots/SKILL.md) -- grounding the assistant in your app
- [markdown](../markdown/SKILL.md) -- markdown, code, math, diagrams
- [react-mcp](../react-mcp/SKILL.md) -- user-managed MCP servers
- [observability](../observability/SKILL.md) -- tracing and span visualization
- [react-native](../react-native/SKILL.md) -- Expo and React Native
- [ink](../ink/SKILL.md) -- terminal chat with Ink
- [update](../update/SKILL.md) -- upgrades and migrations
