Files
wehub-resource-sync e30e75b5d4
Code Quality / Oxlint + Oxfmt (push) Waiting to run
Code Quality / Template Sync (push) Waiting to run
Code Quality / Build Changed Packages (push) Waiting to run
Code Quality / Test Changed Packages (push) Waiting to run
Deploy Expo Example / Deploy Production (push) Waiting to run
Deploy Ink Example / Deploy Production (push) Waiting to run
Python Tests / pytest (assistant-stream, 3.10) (push) Waiting to run
Python Tests / pytest (assistant-stream, 3.12) (push) Waiting to run
Python Tests / pytest (assistant-ui-sync-server-api, 3.10) (push) Waiting to run
Python Tests / pytest (assistant-ui-sync-server-api, 3.12) (push) Waiting to run
Deploy Shadcn Registry / Deploy Production (push) Waiting to run
Template Metrics / LOC + Bundle Size (push) Waiting to run
Changesets / Create Version PR (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:40:13 +08:00
..

AG-UI Protocol Integration

This example demonstrates how to integrate assistant-ui with the AG-UI protocol for connecting to AG-UI compatible agents.

Quick Start

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

1. Start the Backend Agent

# Install Python dependencies
pip install -r server/requirements.txt

# Run the agent (echo mode by default)
python server/agent.py

# Or with OpenAI integration
OPENAI_API_KEY=sk-xxx python server/agent.py

The agent will start at http://localhost:8000/agent.

2. Configure Environment

Create .env.local:

NEXT_PUBLIC_AGUI_AGENT_URL=http://localhost:8000/agent

3. Run the Frontend

pnpm dev

Features

  • AG-UI protocol integration via @assistant-ui/react-ag-ui
  • Multi-thread support with "New Thread" button
  • Custom browser alert tool demonstration
  • Client-side tool execution
  • Tool result rendering

Backend Agent

The included server/agent.py provides:

  • Echo mode (default): Echoes back user messages for testing
  • OpenAI mode: Uses GPT-5.4 Nano when OPENAI_API_KEY is set

Endpoints

  • POST /agent - AG-UI agent endpoint (SSE streaming)
  • GET /health - Health check