assistant-ui logo/Docs/API Reference

API Reference

Complete assistant-ui React API reference for building AI chat UIs with primitives, hooks, runtimes, adapters, tools, transport, voice, and integrations.

Start Here

The React API reference is organized by how you build with assistant-ui:

The lower sections on this page show how the core React contexts nest and where the primary primitives, hooks, and runtime objects are available. Feature-first APIs such as tools, model context, transport, external store, and voice now live in their own generated sections.

Highest Level Context Providers

Assistant Context

The context available to components inside <AssistantRuntimeProvider />. You usually wrap your entire application in this context.

AssistantRuntime

Programmatically access the assistant's state and actions via useAui().

Instructions

Add system prompt instructions

Tool UI

Register toolkits and tool UIs

Programmatically access the list of registered tool UIs via useAuiState((s) => s.tools) and useAui().tools().

ThreadListPrimitive

Shows a list of threads and allows the user to switch between them.

Thread Context

The context for a single thread. Currently always corresponds to the runtime's main thread.

ThreadRuntime

Programmatically access the thread's state and actions.

  • State: useAuiState((s) => s.thread)
  • Actions: useAui().thread()
  • Composer: useAuiState((s) => s.composer)

ModelContext

  • useAui().thread().getModelContext()

ThreadViewportStore

ThreadPrimitive

A conversation thread.

AssistantModalPrimitive

A floating modal that usually appears in the lower right corner of the screen. Common for support use cases.

MessagePart Context

Manages the state and actions for message parts within messages

MessagePartRuntime

  • State: useAuiState((s) => s.part)
  • Actions: useAui().part()

MessagePartPrimitive

MarkdownText

Attachment Context

Manages the state and actions for attachments in messages and composer

AttachmentRuntime

  • State: useAuiState((s) => s.attachment)
  • Actions: useAui().attachment()

AttachmentPrimitive

Utilities