flutter_local_agent_kit 1.1.3
flutter_local_agent_kit: ^1.1.3 copied to clipboard
Offline-first AI framework for Flutter. Resident LLM inference, local RAG, and autonomous agents with a Material 3 Chat UI.
Flutter Local Agent Kit ๐คโจ #
A high-performance, local-first AI orchestration framework for Flutter.
Developed with a focus on privacy, low-latency, and cross-platform hardware acceleration.
๐ Overview #
The Flutter Local Agent Kit enables developers to build state-of-the-art AI applications that run entirely on-device. By bypassing cloud APIs, you eliminate latency, protect user privacy, and remove per-token costs. It is engineered to leverage native GPU acceleration (Metal/Vulkan) and provide a seamless "Google-Expert" level developer experience.
Why this package? #
- ๐ Absolute Privacy: No data ever leaves the device. Ideal for healthcare, finance, and enterprise apps.
- ๐๏ธ Zero Latency: Native bindings to GGUF and ONNX engines ensure immediate inference.
- ๐ฎ Unified UI: A complete, adaptive design system for chat, vision, and voice built with Flutter best practices.
- ๐ ๏ธ Architecture-First: Clean, modular code that separates inference, RAG, and UI layers.
๐ Technical Highlights #
๐๏ธ Multimodal Vision Engine #
Built-in support for CLIP and multimodal projectors. The kit automatically handles image resizing, normalization, and embedding to allow the LLM to "see" your UI or camera feed.
๐ Advanced Local RAG (Retrieval Augmented Generation) #
Powered by an on-device vector database with:
- Chunk-based retrieval for precision.
- Live Citation system: Users see exactly which part of their PDF the answer came from.
- Hybrid Search: Combines semantic vector search with keyword-based BM25.
๐ Model Context Protocol (MCP) Support #
The first Flutter kit to implement the Model Context Protocol. Connect your local agent to thousands of external tools via SSE, enabling the agent to search the web, query databases, or control local files.
๐ Platform Support & Performance #
| Platform | Acceleration | Min Version | Recommended Specs |
|---|---|---|---|
| iOS | Metal (CoreML) | iOS 13.0+ | A12 Bionic or newer |
| macOS | Metal | 10.15+ | Apple Silicon (M1+) |
| Android | Vulkan (NNAPI) | API 24+ | 8GB+ RAM |
๐ป Implementation #
1. Initialization #
Engineered for speed. We recommend initializing once at app startup:
final kit = FlutterLocalAgentKit();
await kit.initialize(
modelPath: 'assets/models/mistral-7b.gguf',
// Forced GPU offloading for maximum performance
gpuLayers: 32,
contextSize: 4096,
);
2. Standardized Chat UI #
The AgentChatView is built for modern UX, supporting Markdown, Code Highlighting, and Voice.
AgentChatView(
onMessage: (content, {imageBytes, onCitations}) {
return kit.askStream(
content,
imageBytes: imageBytes,
onCitations: (results) {
// Logic to render citations in the UI
onCitations?.call(results);
},
);
},
theme: AgentChatTheme.premiumDark(),
)
๐น Desktop Workflow #
Boost productivity with native desktop enhancements:
- Keyboard Shortcuts:
Cmd/Ctrl + Enter: Instantly send queries.Cmd/Ctrl + K: Purge context and clear UI.
- Adaptive Bubbles: Constrained layouts for large monitors to prevent "Wall of Text" fatigue.
๐งช Testing Excellence #
We maintain a "Highest Possible Max" testing standard.
# Run unit tests for core logic
flutter test
# Run the integration suite for full RAG + Vision validation
flutter test test/highest_max_test.dart
๐ค Contributing #
We follow the Google Flutter Style Guide. Pull requests are welcome! Please ensure all tests pass and documentation is updated.
๐ License #
Distributed under the MIT License. See LICENSE for more information.
Built with โค๏ธ for the Flutter Ecosystem.