This is a modern Android application that demonstrates on-device LLM inference using MediaPipe GenAI and Google AI Edge Local Agents. It features a conversational interface with support for native tool triggering (skills) like web search and calendar viewing.
The app uses Skill.md to declare AI Tools: view_calendar and web_search.
SKILLs are placed in feature/chat/src/main/assets
chat/util/SkillLoader.kt is used to find and parse Skills.
Follow these steps to set up the project on your local machine.
Download and install the latest stable version Android Studio Quail 1
of Android Studio (Ladybug or newer recommended).
Clone the repository from GitHub or unzip the provided archive into your preferred workspace directory.
The project requires a Hugging Face User Access Token to download models.
- Generate a token at huggingface.co/settings/tokens ( Read access is sufficient).
- Open (or create) the
local.propertiesfile in the root directory of the project. - Add the following line:
HUGGING_FACE_TOKEN=your_token_here
- Launch Android Studio.
- Select Open and navigate to the project root folder.
- Wait for the Gradle sync to complete.
The project follows a modular architecture:
:core:coroutines: Base classes and utilities for Kotlin Coroutines and Flow-based UseCases.:core:database: Room database implementation for storing chat history.:core:di: Koin dependency injection configuration and extensions.:core:filestore: Manages file operations in the app's internal and cache directories.:core:navigation: Centralized navigation logic using Jetpack Compose Navigation.:core:ui: Shared UI components, themes (Material 3), and base ViewModel.:core:util: General-purpose utility classes and extensions.
:feature:home: The main landing screen.:feature:chat: The conversational interface, including LLM inference logic and skill parsing.:feature:download: Background worker implementation for downloading LLM models from Hugging Face.:feature:settings: Application settings and configuration.:feature:tooling: Native tool implementations (e.g., Jsoup-based web search, Calendar provider).
- The main entry point that wires all modules together and initializes Koin.
- Jetpack Compose: For a modern, declarative UI.
- MediaPipe GenAI: On-device LLM inference.
- Google AI Edge Local Agents: Structured function calling (skills) protocol.
- Koin: Lightweight dependency injection.
- WorkManager: Reliable background model downloading.
- Jsoup: Web scraping for the search tool.
- OkHttp: For network requests.
- Connect a physical Android device (recommended) or an emulator.
- Note: LLM inference is resource-intensive and works best on modern devices (e.g., Pixel 7 or newer).
- Select the
appconfiguration in Android Studio. - Click Run.
- Upon opening the Chat, the app will automatically start downloading the LLM model (~700MB). You can track the progress on the screen.
- A new Gemma 4 LLM doesn't work with MediaPipe engine. It requires LiteRT engine (more advanced implementation).
- Sometimes LLM hallucinates when asking about agenda, view calendar instead of using ' view_calendar' tool
Dmitri Chernysh