showcase/shell-docs/src/content/ag-ui/sdk/dart/overview.mdx
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.
dart pub add ag_ui
void main() async {
// Create client
final client = AgUiClient(
config: AgUiClientConfig(
baseUrl: 'http://localhost:8000',
),
);
// Prepare input
final input = SimpleRunAgentInput(
messages: [
UserMessage(id: 'msg_1', content: 'Hello, agent!'),
],
);
// Stream events
await for (final event in client.runAgent('my-agent', input)) {
switch (event) {
case TextMessageStartedEvent():
print('Assistant started typing...');
case TextMessageDeltaEvent(delta: final delta):
print('Assistant: $delta');
case ToolCallStartedEvent(name: final name):
print('Calling tool: $name');
default:
print('Event: ${event.type}');
}
}
}
The Dart SDK follows a modular architecture aligned with the AG-UI protocol specification:
Add to your pubspec.yaml:
dependencies:
ag_ui: ^1.0.0
Then run:
dart pub get
For Flutter applications:
flutter pub add ag_ui
The Dart SDK supports all Dart platforms:
Explore the CLI example in the example directory:
The SDK includes comprehensive tests:
# Run all tests
dart test
# Run with coverage
dart test --coverage=coverage
# Run specific test file
dart test test/client/client_test.dart
We welcome contributions! Please see our contribution guidelines for details.
MIT License - see LICENSE for details.