runtime
Technical reference for integrating and managing assistant-ui state.
Install
mkdir -p .claude/skills/runtime && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/13485" && unzip -o skill.zip -d .claude/skills/runtime && rm skill.zipInstalls to .claude/skills/runtime
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Guide for assistant-ui runtime system and state management. Use when working with runtimes, accessing state, or managing thread/message data.Key capabilities
- →Access AssistantRuntime hierarchy
- →Manage thread list
- →Access current thread state
- →Perform message operations
- →Handle assistant events
How it works
The skill provides hooks and an API to interact with the assistant-ui runtime, allowing access and modification of thread and message states.
Inputs & outputs
When to use runtime
- →Implement chat control logic
- →Access runtime thread state
- →Listen for assistant events
About this skill
assistant-ui Runtime
Always consult assistant-ui.com/llms.txt for latest API.
References
- ./references/local-runtime.md -- useLocalRuntime deep dive
- ./references/external-store.md -- useExternalStoreRuntime deep dive
- ./references/thread-list.md -- Thread list management
- ./references/state-hooks.md -- State access hooks
- ./references/types.md -- Type definitions
Runtime Hierarchy
AssistantRuntime
├── ThreadListRuntime (thread management)
│ ├── ThreadListItemRuntime (per-thread item)
│ └── ...
└── ThreadRuntime (current thread)
├── ComposerRuntime (input state)
└── MessageRuntime[] (per-message)
└── MessagePartRuntime[] (per-content-part)
State Access (Modern API)
import { useAssistantApi, useAssistantState, useAssistantEvent } from "@assistant-ui/react";
function ChatControls() {
const api = useAssistantApi();
const messages = useAssistantState(s => s.thread.messages);
const isRunning = useAssistantState(s => s.thread.isRunning);
useAssistantEvent("message-added", (e) => {
console.log("New message:", e.message);
});
return (
<div>
<button onClick={() => api.thread().append({
role: "user",
content: [{ type: "text", text: "Hello!" }],
})}>
Send
</button>
{isRunning && (
<button onClick={() => api.thread().cancelRun()}>Cancel</button>
)}
</div>
);
}
Thread Operations
const api = useAssistantApi();
const thread = api.thread();
// Append message
thread.append({ role: "user", content: [{ type: "text", text: "Hello" }] });
// Cancel generation
thread.cancelRun();
// Get current state
const state = thread.getState(); // { messages, isRunning, ... }
Message Operations
const message = api.thread().message(0); // By index
message.edit({ role: "user", content: [{ type: "text", text: "Updated" }] });
message.reload();
Events
useAssistantEvent("thread-started", () => {});
useAssistantEvent("thread-ended", () => {});
useAssistantEvent("message-added", ({ message }) => {});
useAssistantEvent("run-started", () => {});
useAssistantEvent("run-ended", () => {});
Capabilities
const caps = useAssistantState(s => s.thread.capabilities);
// { cancel, edit, reload, copy, speak, attachments }
Quick Reference
// Get messages
const messages = useAssistantState(s => s.thread.messages);
// Check running state
const isRunning = useAssistantState(s => s.thread.isRunning);
// Append message
api.thread().append({ role: "user", content: [{ type: "text", text: "Hi" }] });
// Cancel generation
api.thread().cancelRun();
// Edit message
api.thread().message(index).edit({ ... });
// Reload message
api.thread().message(index).reload();
Common Gotchas
"Cannot read property of undefined"
- Ensure hooks are called inside
AssistantRuntimeProvider
State not updating
- Use selectors with
useAssistantStateto prevent unnecessary re-renders
Messages array empty
- Check runtime is configured
- Verify API response format
When not to use it
- →When not working with assistant-ui runtime system
- →When not managing thread or message data
Prerequisites
Limitations
- →Hooks must be called inside `AssistantRuntimeProvider`
- →Requires correct API response format for messages
How it compares
This skill offers a structured API and hooks for state management in assistant-ui, unlike direct manipulation of UI components.
Compared to similar skills
runtime side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| runtime (this skill) | 0 | 6mo | No flags | Intermediate |
| ai-model-web | 1 | 2mo | Review | Intermediate |
| flowglad-pricing-ui | 1 | 5mo | No flags | Beginner |
| podcast-generation | 1 | 3mo | Review | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
ai-model-web
TencentCloudBase
Use this skill when developing browser/Web applications (React/Vue/Angular, static websites, SPAs) that need AI capabilities. Features text generation (generateText) and streaming (streamText) via @cloudbase/js-sdk. Built-in models include Hunyuan (hunyuan-2.0-instruct-20251111 recommended) and DeepSeek (deepseek-v3.2 recommended). NOT for Node.js backend (use ai-model-nodejs), WeChat Mini Program (use ai-model-wechat), or image generation (Node SDK only).
flowglad-pricing-ui
flowglad
Build pricing pages, pricing cards, and plan displays with Flowglad. Use this skill when creating pricing tables, displaying subscription options, or building plan comparison interfaces.
podcast-generation
microsoft
Generate AI-powered podcast-style audio narratives using Azure OpenAI's GPT Realtime Mini model via WebSocket. Use when building text-to-speech features, audio narrative generation, podcast creation from content, or integrating with Azure OpenAI Realtime API for real audio output. Covers full-stack implementation from React frontend to Python FastAPI backend with WebSocket streaming.
convex-realtime
waynesutton
Patterns for building reactive apps including subscription management, optimistic updates, cache behavior, and paginated queries with cursor-based loading
wagmi-development
wevm
Creates Wagmi features across all layers - core actions, query options, framework bindings. Use when adding new actions, hooks, or working across packages/core, packages/react, packages/vue.
query-layer
EpicenterHQ
Query layer patterns for consuming services with TanStack Query, error transformation, and runtime dependency injection. Use when implementing queries/mutations, transforming service errors for UI, or adding reactive data management.