runtime
assistant-ui Runtime
Always consult assistant-ui.com/llms.txt for the latest API.
A runtime is the state and action layer behind a chat UI: it owns messages, threads, branching, and run lifecycle, and every primitive and hook reads from it through a uniform AssistantClient. There are two ways to build one. LocalRuntime (useLocalRuntime) owns the message store for you; you implement one ChatModelAdapter.run function and branching, editing, and regeneration come for free. ExternalStoreRuntime (useExternalStoreRuntime) is the inverse: you own the messages, and UI features turn on based on which callbacks you supply. Framework adapters such as useChatRuntime (@assistant-ui/ai-sdk) and protocol runtimes such as useAssistantTransportRuntime are built on one of these two. Once mounted under AssistantRuntimeProvider, every runtime is read and driven the same way, through useAui, useAuiState, and useAuiEvent.
References
- ./references/local-runtime.md -- useLocalRuntime deep dive: streaming, tool calls, human-in-the-loop, approval gates, resumeRun
- ./references/external-store.md -- useExternalStoreRuntime deep dive: handler matrix, branching, queueing, tool results
- ./references/state-hooks.md -- useAui, useAuiState, useAuiEvent, state shape, removed legacy hooks
- ./references/types.md -- ThreadMessage, MessageStatus, MessagePart, attachment, and capability types
- ./references/adapters.md -- attachment, speech, dictation, feedback, suggestion, and history adapters
- ./references/voice.md -- realtime duplex voice with RealtimeVoiceAdapter
- ./references/runtime-concepts.md -- unstable_ policy, useAssistantTransportRuntime, MessageNotSentError, reloadMainThread, message timing