AG-UI Dart SDK
The Agent User Interaction Protocol Dart SDK provides a complete implementation for building AI applications in Dart and Flutter. This SDK enables seamless connectivity to AG-UI compatible agent systems with full type safety and reactive programming support.Key Features
- Type-Safe Events: Strongly typed event system with compile-time safety
- Reactive Streams: Built on Dart’s native Stream API for efficient async operations
- SSE Support: Full Server-Sent Events implementation with automatic reconnection
- Binary Protocol: Efficient binary encoding/decoding for optimal performance
- Flutter Ready: Designed for seamless integration with Flutter applications
- Error Handling: Comprehensive error handling with retry strategies
Quick Start
Architecture
The Dart SDK follows a modular architecture aligned with the AG-UI protocol specification:Core Components
Client
Main client for agent connectivity with SSE and binary protocol support
Types
Core data structures including messages, tools, and state
Events
Event types for lifecycle, messages, tools, and state management
Encoder
Binary encoding/decoding for efficient data transmission
Installation
Dart Projects
Add to yourpubspec.yaml:
Flutter Projects
For Flutter applications:Platform Support
The Dart SDK supports all Dart platforms:- Flutter: iOS, Android, Web, Desktop (Windows, macOS, Linux)
- Dart VM: Server-side and CLI applications
- Dart Web: Browser-based applications
Example Application
Explore the CLI example in the example directory:- CLI Tool: Interactive command-line tool demonstrating:
- Basic agent conversation
- Tool-based generative UI flow
- Server-Sent Events streaming
- Auto-tool mode for non-interactive execution
- JSON output for debugging
- Error handling and retry logic