assistant-ui/skills

observability

Instruments assistant-ui AI SDK backend routes with Langfuse, LangSmith, or Helicone, and renders independent trace data with the experimental @assistant-ui/react-o11y SpanResource and SpanPrimitive APIs.

소스 보기
원본 Skill 문서

원본 저장소의 제목, 예시, 코드, 표, 링크, 이미지를 유지해 표시합니다.

assistant-ui Observability

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

Observability has two separate layers. Langfuse, LangSmith, and Helicone instrument backend model calls. @assistant-ui/react-o11y renders span data already collected by your application. It does not send traces to a provider or derive spans from the assistant runtime.

References

Choose the backend integration

Use one provider based on the data model you need.

  • Langfuse receives the OpenTelemetry spans AI SDK emits when experimental_telemetry is enabled. Use it for a hierarchical trace across an agent turn, tool calls, and model calls.
  • LangSmith wraps AI SDK functions through wrapAISDK(ai). Use it when traces, evaluations, and prompt management belong with LangChain or LangGraph tooling.
  • Helicone proxies the provider request. Use it for request logs, costs, latency, and prompt diffs without changing the AI SDK call shape.

Langfuse and Helicone can run together because one consumes OpenTelemetry spans while the other proxies provider traffic. LangSmith is its own wrapper path, so use its wrapped AI SDK functions instead of the originals.

Implementation order

  1. Select the provider integration that owns the telemetry destination.
  2. Add its server environment variables and startup instrumentation or provider configuration.
  3. Instrument one route and verify a real request reaches the provider dashboard.
  4. Add serverless flushing before treating traces as reliable in production.
  5. Render a separate SpanData[] feed with react-o11y only when the product needs an in app trace view.

Route handler boundary

Keep provider credentials and instrumentation on the server. Every example uses openai("gpt-5.6-luna"), awaits convertToModelMessages(messages), and returns the AI SDK UI message response. The integration pages do not use an assistant-ui route helper. If a route needs one, import it from @assistant-ui/ai-sdk; @assistant-ui/react-ai-sdk re-exports the same API for older installs.

Resolve trace attributes from real auth and thread state. Do not put a provider key, Langfuse user ID, LangSmith metadata, or Helicone header in a client component.

Render collected spans

SpanResource({ spans }) accepts the complete raw SpanData[] list, normalizes parent relationships, sorts visible spans by start time, and owns collapse state. Mount it at an isolated provider root:

tsx
const config = AuiConfig({ span: SpanResource({ spans }) });

<AuiProvider extends={null} config={config}>
  <SpanPrimitive.Children components={{ Span: SpanRow }} />
</AuiProvider>;

The SpanRow component is automatically scoped to one visible span. Use SpanPrimitive.Timeline and SpanPrimitive.TimelineBar when rows must share a time axis. Use the copied TraceWaterfall element when a styled flat message and tool waterfall better fits the data you have.

Common Gotchas

Traces disappear on Vercel, Lambda, or another serverless runtime

  • Langfuse needs await langfuseSpanProcessor.forceFlush() before the function exits, or a deployment specific waitUntil path.
  • LangSmith needs await client.awaitPendingTraceBatches() before the function exits.

Langfuse has no spans

  • Set experimental_telemetry: { isEnabled: true } on each traced streamText or generateText call.
  • Register LangfuseSpanProcessor only in the Node runtime. OpenTelemetry does not run in the edge runtime.

LangSmith does not trace the route

  • Call the destructured functions from wrapAISDK(ai), not the originals from ai.
  • Set LANGSMITH_TRACING=true in the runtime environment.

Helicone traffic still goes directly to OpenAI

  • The provider baseURL must be https://oai.helicone.ai/v1 and the request must carry Helicone-Auth as well as the provider authorization header.

A react-o11y view renders no rows

  • Mount SpanResource with AuiConfig({ span: SpanResource({ spans }) }) and render beneath <AuiProvider extends={null} config={config}>.
  • Pass a complete SpanData[] list. SpanPrimitive.Children reads the current span scope and does not fetch traces.

A documented span component is missing

  • SpanPrimitive.ChildByIndex is not re-exported by the current source. Use the exported SpanByIndexProvider with a row component when explicit index scoping is necessary.

Related Skills

  • streaming -- AI SDK stream transport and route response handling.
  • setup -- Project creation, CLI setup, and runtime installation.
  • cloud -- Assistant Cloud persistence and run reporting configuration.
  • elements -- Copied styled elements, including TraceWaterfall.
같은 저장소의 Skills

더 많은 Skills

모든 Skills
assistant-ui
커뮤니티

assistant-ui

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, the framework-neutral @assistant-ui/ai-sdk integration for AI SDK v7 (useChatRuntime, AssistantChatTransport; @assistant-ui/react-ai-sdk re-exports it), @assistant-ui/core, @assistant-ui/store, assistant-stream, assistant-cloud, the adapters for LangGraph, LangChain, Google ADK, A2A, AG-UI, Eve, OpenCode, and Pi, and the platform bindings @assistant-ui/react-native and @assistant-ui/react-ink; AssistantRuntimeProvider; the primitives ThreadPrimitive, MessagePrimitive, ComposerPrimitive; the hooks useAui, useAuiState, useAuiEvent; and runtime selection across useChatRuntime, useExternalStoreRuntime, useLangGraphRuntime, useLocalRuntime. 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.

설치 수
1
GitHub Stars
26
업데이트
9월 4일
assistant-ui
커뮤니티

cloud

Adds AssistantCloud backed persistence, authorization, and telemetry to assistant-ui apps. Use when wiring cross-session thread and message history, multi-device chat, message feedback, file uploads, or auth: passing cloud to useChatRuntime from @assistant-ui/ai-sdk, AISDKThreads({ cloud }) for AuiConfig hosts, the standalone useCloudChat/useThreads hooks from @assistant-ui/cloud-ai-sdk, or cloud on useLangGraphRuntime. Covers constructing AssistantCloud with authToken (JWT), apiKey plus userId/workspaceId (server-side), or anonymous; direct provider integrations (Clerk, Auth0, Supabase, Firebase) and a backend token endpoint; and the client surface verified against source: cloud.threads.{list,get,create,update,delete}, cloud.threads.messages.{list,create,update,feedback}, cloud.files.{generatePresignedUploadUrl,pdfToImages}, cloud.runs.{stream,report}, cloud.projects.threads, cloud.auth.tokens.create, and cloud.telemetry. Also covers a custom ThreadHistoryAdapter built on CloudMessagePersistence/createFormattedPersistence, run telemetry (beforeReport, sub-agent tracking with wrapSamplingHandler), and the NEXTPUBLICASSISTANTBASEURL/ASSISTANTAPIKEY env vars. Route here for threads that do not persist, 401s against the cloud API, or feedback buttons that do not save. For the sidebar UI itself use thread-list; for the general RemoteThreadListAdapter/ThreadHistoryAdapter contract use runtime.

설치 수
1
GitHub Stars
26
업데이트
9월 4일
assistant-ui
커뮤니티

copilots

Grounding an assistant in your app with assistant-ui copilots (@assistant-ui/react). Use when steering assistant behavior with useAssistantInstructions, feeding lazy send-time app state through useAssistantContext({ getContext }), exposing rendered components to the assistant with makeAssistantVisible(Component, { clickable, editable }), giving the model two-way component state through interactables (unstableuseInteractable for app-scoped panels, unstableinteractableTool inside defineToolkit for thread-scoped artifacts, both mounted via AuiConfig({ unstableinteractables: unstableInteractables() })), registering instructions and tools together imperatively with aui.modelContext.register({ getModelContext }), or bridging model context across an iframe boundary with AssistantFrameProvider and useAssistantFrameHost. The legacy Interactables() scope, useAssistantInteractable, and useInteractableState are deprecated since 2026-06-14 and scheduled for removal on or after 2026-09-14; new code uses the unstable API. Reach for this when the assistant should read the current page, click or edit UI, read and update component state through auto-generated update{name} tools, or receive tools and instructions from a sandboxed iframe. For LLM tools and tool-call UI use the tools skill; for runtime and thread state use the runtime skill.

설치 수
1
GitHub Stars
26
업데이트
9월 4일
assistant-ui
커뮤니티

elements

Installs and customizes assistant-ui elements, the styled shadcn-style component catalog at assistant-ui.com/elements served from the r.assistant-ui.com registry through npx assistant-ui@latest add . Use when adding a prebuilt chat surface or widget (Thread, ThreadList, AssistantModal, AssistantSidebar, ToolFallback, ToolGroup, MarkdownText, Reasoning, Sources, Attachment, ModelSelector, Voice orb, McpConfig) or one of the 120 standalone elements (approval card, agent plan, code diff, data table, chart, trace waterfall, message queue, composer variants, and so on), choosing between runtime-connected .aui.tsx files and props-driven standalone files, overriding Thread slots through the components prop, editing the copied source under components/assistant-ui/elements/, using the shared surfaces.tsx tokens, or picking the Radix versus Base UI flavor through the style-aware registry URL in components.json. Route here when an import from @/components/assistant-ui/... fails, an element renders unstyled, or the CLI installs the wrong flavor. For unstyled building blocks use primitives; for the CLI scaffold itself use setup.

설치 수
1
GitHub Stars
26
업데이트
9월 4일