A comprehensive and feature-rich demonstration of the Agent User Interaction Protocol (AG-UI) with 10+ demo scenarios, 6 interactive tools, and advanced debugging capabilities. This enhanced demo showcases real-time agent communication, complex workflows, and human-in-the-loop interactions.
- π Basic Text Streaming - Real-time message streaming
- π§ Tool Calling Workflow - Complete tool lifecycle
- π State Synchronization - Snapshots and deltas
- π― Multi-Step Workflow - Complex agent processes
β οΈ Error Scenarios - Error handling and recovery- β‘ Custom Events - Application-specific events
- π€ Human-in-the-Loop - Interactive confirmations
- π₯ Real-time Collaboration - Bidirectional state sharing
- π Data Analysis Workflow - Complete analysis pipeline
- π Progressive Enhancement - Feature evolution
- 6 interactive tools with streaming arguments
- Tool performance metrics and timing
- Real-time tool status visualization
- Category-based tool organization
- Real-time event statistics
- Response time analytics
- Tool call duration tracking
- Error rate monitoring
- Scenario filtering by category
- Interactive event log export
- Advanced debugging panels
- Performance metrics dashboard
This demo implements the AG-UI protocol to create a standardized interface between AI agents and frontend applications. It demonstrates:
- Real-time streaming communication between agents and UI
- Event-driven architecture following AG-UI specification
- Tool calling mechanisms for human-in-the-loop workflows
- State synchronization between agent and frontend
- Multiple backend implementations (SignalR/.NET and Socket.IO/Node.js)
- Performance monitoring and analytics
- Advanced debugging and troubleshooting tools
The AG-UI Protocol Demo interface showing demo scenarios (left), chat interface (center), and real-time event log (right)
Real-time demonstration of AG-UI protocol events including message streaming, tool calling, and state synchronization
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Frontend β β Communication β β Backend β
β (Svelte) βββββΊβ Layer βββββΊβ (.NET/Node) β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β β β
β β β
βΌ βΌ βΌ
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Enhanced β β SignalR/ β β Smart Agent β
β AgentChat β β Socket.IO β β Services β
β Component β β with Analytics β β with Scenarios β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
- Complete implementation of AG-UI events
- Lifecycle events (RUN_STARTED, RUN_FINISHED, STEP_STARTED, STEP_FINISHED, RUN_ERROR)
- Text message streaming (TEXT_MESSAGE_START, TEXT_MESSAGE_CONTENT, TEXT_MESSAGE_END)
- Tool call events (TOOL_CALL_START, TOOL_CALL_ARGS, TOOL_CALL_END, TOOL_CALL_RESULT)
- State management (STATE_SNAPSHOT, STATE_DELTA, MESSAGES_SNAPSHOT)
- Special events (CUSTOM, RAW)
- SignalR/.NET 8: Enterprise-grade real-time communication with smart scenario detection
- Socket.IO/Node.js: Lightweight, flexible implementation
- 10 interactive demo scenarios: From basic streaming to complex workflows
- 6 professional tools: User management, document search, code analysis, weather, confirmations
- Real-time performance metrics: Event counting, response times, error tracking
- Advanced state management: History tracking, delta visualization, JSON Patch support
- Smart scenario detection: Backend automatically detects demo intent from user messages
- Interactive event monitoring: Real-time AG-UI event log with filtering and details
- Multi-scenario demonstrations: Pre-built scenarios for testing different AG-UI features
- Human-in-the-loop workflows: User confirmation, preferences, and collaborative decision-making
- Error handling showcase: Demonstration of error recovery and resilience patterns
- π Basic Text Streaming: Real-time character-by-character message display
- π§ Tool Calling Workflow: Complete tool lifecycle with argument streaming
- π State Synchronization: STATE_SNAPSHOT and STATE_DELTA demonstrations
- π― Multi-Step Workflow: Complex tasks with multiple tools and state updates
β οΈ Error Handling: Error scenarios and recovery patterns- β‘ Custom Events: CUSTOM and RAW event demonstrations
- π€ Human-in-the-Loop: User confirmation and collaborative workflows
- π₯ Real-time Collaboration: Bidirectional state sharing
- getUserPreferences: User settings and configuration management
- searchDocuments: Knowledge base search with filtering and pagination
- confirmAction: Human-in-the-loop confirmation workflows
- analyzeCode: Code analysis with security, performance, and style checks
- weatherLookup: External API integration demonstration
- createReminder: Task and reminder creation
- saveUserPreferences: Persistent user configuration
- generateChart: Data visualization tools
- Error handling: Robust connection and error management
- Node.js 18+ and npm
- .NET 8 SDK (for SignalR backend)
- Modern web browser
# Clone the repository
git clone <repository-url>
cd ag-ui-demo1
# Install frontend dependencies
cd frontend
npm install
# Install Node.js backend dependencies
cd ../backend/nodejs-mock-server
npm install
# Return to project root
cd ../..Terminal 1: Start Node.js Backend
cd backend/nodejs-mock-server
npm run dev
# Or: npm startThis starts the Node.js backend on port 5001
Terminal 2: Start Frontend
cd frontend
npm run devThis starts the frontend on port 5173
Terminal 1: Start .NET Backend
cd backend/dotnet-signalr-server
dotnet runThis starts the .NET SignalR backend on port 5000
Terminal 2: Start Frontend
cd frontend
npm run devThis starts the frontend on port 5173
cd frontend
npm run dev- Frontend: http://localhost:5173
- Node.js Backend: http://localhost:5001
- Backend Health Check: http://localhost:5001/health (Node.js) or http://localhost:5000/health (.NET)
- Available Tools: http://localhost:5001/tools (Node.js)
- Select Backend: Choose between Socket.IO (Node.js) or SignalR (.NET) using the radio buttons
- View Guide: Click "Show Guide" to see available scenarios and protocol documentation
- Try Demo Scenarios: Use the colored demo buttons to trigger specific AG-UI feature demonstrations
- Monitor Events: Watch the Event Log panel to see real-time AG-UI events
- Observe State: Check the Agent State panel to see state synchronization in action
- Track Tools: Monitor the Tool Calls panel to see tool execution lifecycle
- Interactive Chat: Type messages to have natural conversations with the agent
βββ frontend/ # Svelte frontend application
β βββ src/
β β βββ lib/
β β β βββ components/ # UI components
β β β β βββ AgentChat.svelte
β β β βββ SignalRAgent.ts # SignalR client
β β β βββ SocketIOAgent.ts # Socket.IO client
β β β βββ types.ts # AG-UI type definitions
β β βββ App.svelte # Main application
β β βββ main.ts
βββ backend/
β βββ dotnet-signalr-server/ # .NET SignalR implementation
β β βββ AgentHub.cs # SignalR Hub with AG-UI events
β β βββ Program.cs
β βββ nodejs-mock-server/ # Node.js Socket.IO implementation
β βββ server.js # Express + Socket.IO server
β βββ package.json
βββ docs/ # Multilingual documentation
βββ en/ # English documentation
βββ zh/ # Chinese documentation
βββ README.md # This file
This demo showcases the complete AG-UI protocol implementation:
-
Lifecycle Events
RUN_STARTED: Agent execution beginsRUN_FINISHED: Agent execution completesRUN_ERROR: Agent execution failsSTEP_STARTED: Agent step beginsSTEP_FINISHED: Agent step completes
-
Message Events
TEXT_MESSAGE_START: Message streaming beginsTEXT_MESSAGE_CONTENT: Message content chunksTEXT_MESSAGE_END: Message streaming completes
-
Tool Events
TOOL_CALL_START: Tool execution beginsTOOL_CALL_ARGS: Tool arguments streamingTOOL_CALL_END: Tool call completesTOOL_CALL_RESULT: Tool execution result
-
State Events
STATE_SNAPSHOT: Complete state synchronizationSTATE_DELTA: Incremental state updates
The demo includes several example tools demonstrating the AG-UI tool calling pattern:
const tools = [
{
name: "getUserPreferences",
description: "Get user preferences and settings",
parameters: {
type: "object",
properties: {
userId: { type: "string", description: "The user ID" }
},
required: ["userId"]
}
},
// More tools...
];- Define tool in
frontend/src/App.svelte:
const newTool = {
name: "myTool",
description: "Description of what this tool does",
parameters: {
type: "object",
properties: {
param1: { type: "string", description: "Parameter description" }
},
required: ["param1"]
}
};- Handle tool execution in backend
- Test tool calling in the frontend interface
Extend the event handling in AgentChat.svelte:
function handleAgentEvent(event: AGUIEvent) {
switch (event.type) {
case EventType.CUSTOM:
// Handle custom events
break;
// ... other cases
}
}Comprehensive documentation is available in multiple languages:
- Architecture Guide
- Development Setup
- API Reference
- Troubleshooting
- Contributing Guidelines
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Update documentation
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For questions and support:
- Create an issue in this repository
- Join the discussion in AG-UI GitHub Discussions
- Check the troubleshooting guide