A pedagogical fullstack TypeScript demonstration application showcasing how LLM chatbot frontends interact with their backends using the AG-UI (Agent-UI) protocol with A2UI support for dynamic UI component rendering.
Autobot is designed to teach and demonstrate the technical architecture of modern LLM applications. It features:
- Real-time visualization of all exchanges between frontend β backend β LLM
- AG-UI protocol implementation for structured agent communication
- A2UI (Agent-to-UI) support - LLMs can create interactive UI components (buttons, charts, cards, forms, etc.)
- Two-panel interface: Technical debug view + User chat view
- Ultra-simple embedded storage using JSON files
- Full TypeScript codebase for type safety and clarity
This project helps developers understand:
- How LLM APIs work - See actual requests and responses
- Backend orchestration - Observe message routing and state management
- Real-time communication - Learn WebSocket patterns for live updates
- AG-UI protocol - Understand structured agent-to-UI communication
- A2UI protocol - Learn how LLMs can create dynamic UI components
- Function calling - See how LLMs use tools to enhance responses
- Fullstack architecture - See how all pieces fit together
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Frontend (React) β
β ββββββββββββββββ βββββββββββββββββ β
β β Debug Panel β β Chat Panel β β
β β (Technical) β β (User View) β β
β ββββββββββββββββ βββββββββββββββββ β
β β WebSocket β HTTP β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Backend (Express + WebSocket) β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β Storage β β LLM Service β β Debug Eventsβ β
β β (JSON) β β (OpenAI) β β Broadcaster β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
ββββββββββββββββββββββ
β OpenAI API β
β (or compatible) β
ββββββββββββββββββββββ
- Node.js 18+ and npm
- OpenAI API key (or compatible endpoint)
- Clone the repository:
git clone https://github.com/evaisse/autobot.git
cd autobot- Install dependencies:
npm install- Start the development servers:
npm run devThis will start:
- Backend server on
http://localhost:3001 - Frontend application on
http://localhost:3000
-
Open your browser to
http://localhost:3000 -
Configure your OpenAI API credentials:
- API Endpoint:
https://api.openai.com/v1 - API Key: Your OpenAI API key
- Model:
gpt-3.5-turbo(or any compatible model)
- API Endpoint:
-
Start chatting and watch the debug panel to see everything that happens!
If you're targeting Azure OpenAI endpoints, you can run a small probe script to see which features your deployment supports (tool calling, streaming, vision, and reasoning parameters). It sends a handful of minimal test requests and prints a simple PASS/FAIL table.
export AZURE_OPENAI_API_ENDPOINT="https://YOUR-RESOURCE.openai.azure.com"
export AZURE_OPENAI_API_KEY="YOUR_KEY"
export AZURE_OPENAI_API_VERSION="YOUR_API_VERSION"
export AZURE_OPENAI_DEPLOYMENT_NAME="YOUR_DEPLOYMENT"
npm run azure:capabilitiesOptional extras:
AZURE_OPENAI_TEST_IMAGE_URLto probe vision with a real image URLAZURE_OPENAI_REASONING_PARAMSto override which reasoning params to try- CLI overrides:
--endpoint,--api-version,--deployment
autobot/
βββ packages/
β βββ backend/ # Express backend server
β β βββ src/
β β β βββ index.ts # Main server file
β β β βββ types/ # TypeScript type definitions
β β β βββ storage/ # Simple file-based storage
β β β βββ services/ # LLM service implementation
β β βββ package.json
β β
β βββ frontend/ # React frontend application
β βββ src/
β β βββ App.tsx # Main app component
β β βββ components/ # React components
β β β βββ ConfigForm.tsx # API configuration
β β β βββ ChatPanel.tsx # Chat interface
β β β βββ DebugPanel.tsx # Debug events display
β β βββ hooks/ # Custom React hooks
β β βββ types/ # TypeScript type definitions
β βββ package.json
β
βββ package.json # Root package (workspace)
βββ README.md # This file
The user provides their OpenAI API credentials through a simple form. These are stored locally using the embedded JSON storage system.
When a user sends a message:
- Frontend creates a "user message received" debug event
- Backend receives the message via HTTP POST
- Backend loads conversation history from storage
- Backend calls the OpenAI API with function calling enabled (A2UI tools)
- LLM processes the request and may call UI component creation functions
- Backend parses tool calls and creates UI components
- Backend saves the updated conversation to storage
- Backend broadcasts debug events via WebSocket
- Frontend displays the response with any UI components
When the LLM decides to create a UI component:
- LLM calls the
render_ui_componentfunction with type and props - Backend creates a
tool_calldebug event - Component is added to the message's
uiComponentsarray - Frontend UIComponentRenderer dynamically renders the component
- Debug panel shows the component creation in real-time
Supported Components:
- π Buttons - Interactive actions with variants
- π΄ Cards - Rich content with images and actions
- π Charts - Data visualizations (bar, line, pie)
- π Lists - Organized items with icons
- π Forms - Input collection fields
- π Tables - Structured data display
- π Progress - Task completion indicators
β οΈ Alerts - Notifications with severity levels
The debug panel shows every step in real-time:
- π₯οΈ Frontend events (user actions)
- βοΈ Backend events (processing)
- π€ LLM events (API calls and responses)
- π¨ Tool calls (UI component creation)
Each event includes:
- Timestamp
- Event type (request, response, tool_call, error, etc.)
- Source component
- Detailed data payload
- Human-readable description
POST /api/config- Save API configurationGET /api/config- Get current configuration (without API key)
POST /api/chat- Send a chat messageGET /api/conversations/:id- Get conversation historyGET /api/conversations- List all conversations
GET /api/tools- Get available LLM tools
ws://localhost:3001- Real-time debug events
The AG-UI (Agent-UI) protocol is a structured communication pattern between LLM agents and user interfaces. Key concepts:
interface Message {
id: string;
role: 'user' | 'assistant' | 'system';
content: string;
timestamp: number;
}interface DebugEvent {
id: string;
timestamp: number;
type: 'request' | 'response' | 'tool_call' | 'thought' | 'error';
source: 'frontend' | 'backend' | 'llm';
data: any;
description: string;
}Autobot uses an ultra-simple file-based storage system:
- Configuration:
data/config.json - Conversations:
data/conversation_{id}.json
This approach is perfect for:
- Local development
- Demonstrations
- Learning purposes
- Quick prototyping
For production use, you would replace this with a proper database.
- API keys are stored in local files only
- Keys are never sent to any third party except OpenAI
- The debug panel helps you verify what data is being sent
- For production, use environment variables and secure storage
The application includes demonstration pages showcasing different UI components:
Ask: "Show me some button options"
The LLM creates interactive buttons with different variants:
- Primary actions (blue)
- Secondary actions (gray)
- Danger actions (red)
Ask: "Show me sales data for this quarter"
The LLM visualizes data as bar charts with:
- Multiple data series
- Animated bars
- Value labels
- Professional styling
Ask: "Show me information about the new feature"
The LLM creates rich content cards with:
- Header images or icons
- Titles and descriptions
- Action buttons
- Clean, modern design
View live demos: Visit /demos/demo-button.html, /demos/demo-chart.html, or /demos/demo-card.html after starting the dev server.
This is a pedagogical project! Contributions that improve:
- Documentation and explanations
- Code clarity and comments
- Educational value
- Examples and use cases
are highly welcome!
MIT License - Feel free to use this project for learning and teaching!
- Inspired by the need to understand LLM architectures
- Built to demonstrate the AG-UI protocol concepts
- Created for the developer community to learn from
To dive deeper into the codebase:
- Start with
/packages/backend/src/index.ts- Main server logic - Read
/packages/frontend/src/App.tsx- Frontend orchestration - Explore
/packages/backend/src/services/llm.ts- LLM integration with A2UI - Check
/packages/frontend/src/components/UIComponentRenderer.tsx- Dynamic UI rendering - Review
/packages/frontend/src/components/DebugPanel.tsx- Event visualization
Every file is thoroughly commented to aid understanding!
Happy Learning! π