e30e75b5d4
Changesets / Create Version PR (push) Has been cancelled
Deploy Shadcn Registry / Deploy Production (push) Has been cancelled
Template Metrics / LOC + Bundle Size (push) Has been cancelled
Code Quality / Oxlint + Oxfmt (push) Has been cancelled
Code Quality / Template Sync (push) Has been cancelled
Code Quality / Build Changed Packages (push) Has been cancelled
Code Quality / Test Changed Packages (push) Has been cancelled
Deploy Expo Example / Deploy Production (push) Has been cancelled
Deploy Ink Example / Deploy Production (push) Has been cancelled
Python Tests / pytest (assistant-stream, 3.10) (push) Has been cancelled
Python Tests / pytest (assistant-stream, 3.12) (push) Has been cancelled
Python Tests / pytest (assistant-ui-sync-server-api, 3.10) (push) Has been cancelled
Python Tests / pytest (assistant-ui-sync-server-api, 3.12) (push) Has been cancelled
67 lines
1.4 KiB
Markdown
67 lines
1.4 KiB
Markdown
# 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
|
|
|
|
### Using CLI (Recommended)
|
|
|
|
```bash
|
|
npx assistant-ui@latest create my-app --example with-ag-ui
|
|
cd my-app
|
|
```
|
|
|
|
### 1. Start the Backend Agent
|
|
|
|
```bash
|
|
# 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
|
|
|
|
```bash
|
|
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
|
|
|
|
## Related Documentation
|
|
|
|
- [assistant-ui Documentation](https://www.assistant-ui.com/docs)
|
|
- [AG-UI Protocol](https://docs.ag-ui.com)
|