Dosu LogoDosu Logo
Ask
Join our Discord
assistant-ui's SpacePublic
assistant-ui
Documentsassistant-ui's Space
README
README
Type
External
Status
Published
Created
Mar 17, 2026
Updated
Sep 29, 2026
Updated by
Dosu Bot
Source
examples/with-assistant-transport/README.md

Assistant Transport Example#

This example demonstrates how to use assistant-ui with the useAssistantTransportRuntime hook to connect to a custom backend server that implements the assistant-transport protocol.

Quick Start#

Using CLI (Recommended)#

npx assistant-ui@latest create my-app --example with-assistant-transport
cd my-app

Environment Variables#

Create .env.local:

NEXT_PUBLIC_API_URL=http://localhost:8000/assistant

Run#

npm install
npm run dev

The application will be available at http://localhost:3000.

Overview#

The Assistant Transport runtime allows you to connect assistant-ui to any backend server that can handle:

  • AddMessageCommand - for sending user messages
  • AddToolResultCommand - for sending tool execution results
  • Streaming responses using the assistant-stream format

Backend Server Requirements#

Your backend server should:

  1. Accept POST requests at the configured endpoint (e.g., /assistant)
  2. Handle the following command types in the request body:
    • AddMessageCommand: { type: "add-message", message: { role: "user", id: "client-message-id", parts: [...] } }
    • AddToolResultCommand: { type: "add-tool-result", toolCallId: string, result: object }
  3. Return streaming responses using the assistant-stream format
  4. Include CORS headers to allow requests from the frontend

Key Features#

  • Custom Runtime: Uses useAssistantTransportRuntime to connect to any backend
  • Streaming Support: Handles real-time streaming responses from the server
  • Tool Support: Supports tool calling between frontend and backend
  • Error Handling: Includes proper error handling and loading states
  • Modern UI: Built with Tailwind CSS and Radix UI components

Related Documentation#

  • assistant-ui Documentation
  • Assistant Transport Runtime API
Documents
AG-UI Message History Management
CHANGELOG
CHANGELOG
CHANGELOG
external-store
overview
README
AG-UI Streaming State Management
hooks
index
introduction
overview
part-1
README
README
stockbroker
AI SDK Integration
ai-sdk
assistant-runtime-provider
expo
hooks
index
index
index
introduction
migration
migration
overview
part-2
README
README
README
README
README
README
README
README
stockbroker
Cloud Message Pagination
index
Generative UI Date and Time Controls
In-Memory Thread Lifecycle
CHANGELOG
CHANGELOG
CHANGELOG
Local Runtime Message History
CHANGELOG
Markdown Preprocessing and Repair
CHANGELOG
CHANGELOG
MCP App Tool UI Rendering
CHANGELOG
CHANGELOG
message
MCP OAuth State Management
MessageRepository Branch Pointer Invariant
Next.js Cache Components
Remote Thread List Runtime
adapters
CHANGELOG
CHANGELOG
hooks
index
README
README
thread-runtime
Render Prop Leakage
Run Cancellation and Abort Signal Propagation
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
README
Run Telemetry Model ID Extraction
SSR-Safe Thread ID Generation
Stream Decoder Buffer Limits
CHANGELOG
CHANGELOG
StreamdownTextPrimitive
index
Streaming Markdown Rendering
CHANGELOG
CHANGELOG
index
introduction
part-1
AGENTS
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CODE_OF_CONDUCT
CONTRIBUTING
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README_LANGGRAPH
SECURITY
SPEC
SPEC_AssistantFrame
SPEC_ModelContextRegistry
action-bar
action-bar-more
adapters
artifacts
assistant-if
assistant-modal
assistant-modal
assistant-runtime
assistant-sidebar
attachment
attachment
attachment-runtime
branch-picker
chatgpt
claude
composer
composer-runtime
composition
context-display
custom-backend
custom-backend
error
file
form-demo
grok
heat-graph
hooks
image
index
index
index
index
index
index
index
index
index
markdown
mem0
mermaid
message-part
message-part-runtime
message-runtime
message-timing
modal
model-selector
part-3
perplexity
pick-a-runtime
primitives
primitives
quote
reasoning
selection-toolbar
sources
suggestion
syntax-highlighting
thread
thread
thread-list
thread-list
thread-list-item
thread-list-item-more
thread-list-item-runtime
thread-list-runtime
tool-fallback
tool-group
tw-shimmer
v4-legacy
v5-legacy