Skip to content
@local-ai-mobile

Local AI: Mobile

Production-grade, 100% on-device AI ecosystem for Android: inference engine (llama.cpp GGUF, LiteRT, Gemini Nano), MCP tools, and agent workflows.

local-ai-mobile

local-ai-mobile Banner

Production-Grade, 100% Offline, On-Device AI Ecosystem for Android Developers

Empowering Android applications to run large language models, expose Model Context Protocol (MCP) system tools, and orchestrate autonomous multi-step agentic reasoning completely on-device — zero cloud API keys, zero subscription costs, and 100% data privacy.

Official Website Google Play Store License: Apache 2.0 Platform: Android API 26+ Language: Kotlin 2.2+ Architecture: 100% Offline Protocol: MCP 2024-11-05 Compliant Build: Passing


🌟 Executive Overview

local-ai-mobile is an open-source engineering initiative providing Android developers with modular, enterprise-ready building blocks for on-device AI and mobile LLM inference. Instead of sending private user conversations, device sensors, and system files over cellular networks to costly third-party cloud servers, our ecosystem enables physical hardware silicon — including Qualcomm Hexagon NPUs, MediaTek APUs, Vulkan GPUs, and ARM NEON SIMD engines — to process inferences and coordinate autonomous actions with sub-millisecond latencies and zero data leakage.

The ecosystem is architected into three specialized, decoupled, and independently deployable libraries under the Apache 2.0 license:

  1. android-inference-engine: Universal on-device inference runtime powering offline llama.cpp Android (GGUF universal quantization), Google LiteRT NPU acceleration (formerly TensorFlow Lite), and Gemini Nano Android via Android 14+ AICore.
  2. android-mcp-tools: The standard Android Model Context Protocol (MCP) implementation providing 9 on-device system tools, robust multi-IPC transports (AIDL, ContentProvider, Messenger, HTTP/SSE), and strict 4-mode user authorization gates.
  3. android-agent-workflow: Production-ready autonomous mobile agent framework featuring an iterative Plan-Execute-Observe-Verify reasoning loop, mobile context distillation (~300 char compaction), 3-tier request routing, and battery-guarded background execution.

📱 Experience the Flagship App on Android

The libraries across the local-ai-mobile ecosystem serve as the high-performance core engine powering Local AI, the flagship consumer Android application for private on-device intelligence:

  • 🌐 Official Website: https://localai.shanaka.dev/
  • 📲 Google Play Store: Get Local AI on Google Play
  • 🔒 100% Offline & Private: Experience ultra-low latency token generation, system tool discovery, and autonomous agent loops directly on your Android smartphone — zero cloud subscriptions, zero data tracking.

🏗️ Ecosystem Architecture

The diagram below illustrates the end-to-end architecture of the local-ai-mobile stack, from top-level Android UI applications down to specialized device silicon:

+=============================================================================+
|                          Android Application Layer                          |
|             (Jetpack Compose UI, Foreground Services, WorkManager)          |
+=============================================================================+
                                       │
                                       ▼
+=============================================================================+
|                         android-agent-workflow                              |
|  • Autonomous Plan-Execute-Observe-Verify Reasoning Loop                    |
|  • 3-Tier Intelligent Coordinator:                                          |
|      - Tier 1: Instant Chit-Chat (0 tool calls, 0 overhead)                 |
|      - Tier 2: Single Tool Fast Path (Deterministic & Scoped Generative)    |
|      - Tier 3: Multi-Step Agentic Pipelines & Slash Commands (/plan,/boost) |
|  • Context Distillation (~300 char compaction) & Rolling Window (4 turns)   |
|  • Isolated Context Scratchpad (0 token pollution in conversation history)   |
|  • SQLite Checkpoint State Machine & Battery-Safe WorkManager Scheduling    |
+======================================+======================================+
                                       │
                ┌──────────────────────┴──────────────────────┐
                ▼                                             ▼
+==============================+             +================================+
|      android-mcp-tools       |             |    android-inference-engine    |
| • Model Context Protocol     |             | • Dual-Engine Architecture:    |
|   (2024-11-05 Specification) |             |     - llama.cpp GGUF Universal |
| • 9 Sandboxed System Tools:  |             |     - LiteRT NPU / GPU / CPU   |
|   - device_telemetry         |             |     - Gemini Nano AICore System|
|   - clipboard_copilot        |             | • Hardware Profiler & KleidiAI |
|   - math_evaluator           |             | • Real-Time TPS & Context Cfg  |
|   - device_clock_timer       |             | • Thermal Throttling Guards    |
|   - file_inspector (sandbox) |             | • Power & Battery Checkpoints  |
|   - notes & calendar store   |             | • Dynamic Tokenizer Templates  |
| • Multi-IPC Transports:      |             |   (ChatML, Llama3, Gemma, Phi) |
|   - ContentProvider & AIDL   |             +================================+
|   - Loopback HTTP/SSE (8765) |                              │
| • 4 Security Approval Modes  |                              │
|   (ALWAYS_ASK, SENSITIVE,    |                              │
|    AUTO_DECIDE, NEVER_ASK)   |                              │
+==============================+                              │
                │                                             │
                └──────────────────────┬──────────────────────┘
                                       │
                                       ▼
+=============================================================================+
|                        Android Device Hardware Layer                        |
|                                                                             |
|  [Qualcomm Snapdragon]      [MediaTek Dimensity]         [Google Tensor]    |
|   Hexagon HTP / NPU          NeuroPilot APU               EdgeTPU           |
|   Adreno GPU (Vulkan)        Mali / Immortalis GPU        Mali GPU          |
|                                                                             |
|  [Generic 64-bit ARMv8 / ARMv9 CPU Silicon]                                 |
|   ARM NEON SIMD Vectorization • DotProd / I8MM • KleidiAI Micro-Kernels     |
+=============================================================================+

📦 Repository Matrix

Every repository in the local-ai-mobile ecosystem is built as an independent, fully tested, and self-contained open-source project.

Repository Description Key Capabilities Maven Coordinates
android-inference-engine Universal on-device LLM inference runtime with zero cloud dependencies. • llama.cpp GGUF universal quantization
• LiteRT NPU & GPU delegate acceleration
• Gemini Nano Android 14+ AICore integration
• Thermal throttling & battery guards
dev.localai.inference:inference-engine:1.0.0
android-mcp-tools Standard on-device Model Context Protocol server and system tool suite. • Full MCP 2024-11-05 JSON-RPC 2.0 support
• 9 sandboxed on-device system tools
• Multi-IPC: ContentProvider, AIDL, HTTP (8765)
• 4 user approval security modes
dev.localai.mcp:mcp-tools:1.0.0
android-agent-workflow Autonomous on-device agent framework with multi-step reasoning loops. • Plan-Execute-Observe-Verify autonomous loop
• Context distillation (~300 char compaction)
• 3-tier coordinator & slash commands
• WorkManager background scheduling
dev.localai.agent:agent-workflow:1.0.0

⚡ 10-Line Developer Quickstart

Integrating on-device AI, system tools, and autonomous agent loops requires only a few lines of clean, idiomatic Kotlin code:

// 1. Initialize on-device inference engine with NPU acceleration
val inference = InferenceEngine.create(context).apply {
    loadModel("models/qwen2.5-3b-instruct-q4_k_m.gguf", EngineOptions(useNpu = true, threadCount = 4))
}
// 2. Initialize MCP system tool registry with 4-mode security gating
val tools = McpToolRegistry.createDefault(context, approvalMode = AgentApprovalMode.SENSITIVE_ONLY)

// 3. Build the autonomous workflow engine connecting inference and tools
val agent = AgentWorkflowEngine.Builder(context)
    .withInferenceEngine(inference)
    .withToolRegistry(tools)
    .build()

// 4. Execute an autonomous multi-step objective 100% offline
val session = agent.executeObjective("/plan Check battery drain, inspect logcat errors, and summarize notes")

// 5. Inspect the verified resolution (zero cloud API keys, zero data leaves the device)
println("Final Resolution: ${session.resolution?.finalResponse}")

🚀 Hardware Acceleration & Silicon Support Matrix

Our runtimes leverage physical silicon acceleration across major mobile chipsets:

Manufacturer / Platform Silicon Family Acceleration Engine Precision / Formats Supported Backends
Qualcomm Snapdragon Snapdragon 8 Gen 1 / 2 / 3 / 4, 7+ Gen 2 Hexagon NPU (HTP) & Adreno GPU INT4, INT8, FP16 Qualcomm QNN, LiteRT HTP Delegate, Vulkan Compute
MediaTek Dimensity Dimensity 9000 / 9200 / 9300 / 9400 NeuroPilot APU & Mali/Immortalis GPU INT8, FP16 MediaTek NeuroPilot, LiteRT APU Delegate, Vulkan
Google Tensor Tensor G1 / G2 / G3 / G4 Google EdgeTPU INT8, FP16 LiteRT EdgeTPU Delegate, Android AICore Gemini Nano
Samsung Exynos Exynos 2200 / 2400 Xclipse GPU (AMD RDNA) & NPU FP16, INT8 Vulkan Compute, LiteRT NPU Delegate
Generic ARMv8 / ARMv9 Cortex-A55 / A78 / X1 / X2 / X3 / X4 / X925 CPU SIMD & Vector extensions Q4_K_M, Q8_0, FP16 ARM NEON, DotProd, I8MM, KleidiAI Optimized Kernels

🔍 Developer SEO & Keyword Discovery

Engineered for mobile AI practitioners, systems engineers, and Android architects searching for:

  • on-device AI: Run state-of-the-art transformer models directly in client apps without recurring cloud inference costs.
  • mobile LLM inference: Ultra-low-latency text generation, token streaming, and speculative decoding on Android.
  • Android Model Context Protocol: Standardized client-server protocol enabling LLMs to safely query local databases, inspect files, and execute system commands.
  • MCP server Android: Native Kotlin implementation of Anthropic's Model Context Protocol over AIDL, ContentProvider, and loopback HTTP/SSE.
  • autonomous mobile agent: ReAct planning loops, step-by-step tool execution, and verification gates designed for edge resource budgets.
  • offline llama.cpp Android: High-performance C++ GGUF inference compiled for Android ABI targets (arm64-v8a, armeabi-v7a, x86_64).
  • LiteRT NPU acceleration: Leverage Google's official on-device machine learning runtime with hardware-accelerated delegates.
  • Gemini Nano Android: Integrate zero-byte APK system models on Android 14+ via official AICore services.
  • privacy-first mobile AI: Guarantee HIPAA, GDPR, and enterprise compliance by ensuring zero bytes of user data ever transit the network.

🛡️ Security & Privacy Architecture

Security in local-ai-mobile is designed from the silicon layer up:

  • Sandboxed File Operations: All file inspector operations strictly validate paths against canonical storage directories, preventing path traversal attacks (../).
  • Caller Identity Verification: IPC endpoints verify the package signature and UID of calling applications.
  • Context Distillation & Prompt Defense: Tool outputs are distilled (~300 characters) and kept in isolated scratchpads, mitigating adversarial prompt injections.
  • Thermal & Memory Throttling: Real-time hardware listeners throttle generation or suspend background tasks when thermal thresholds (THERMAL_STATUS_SEVERE) or memory limits are approached.

For full disclosure policies and vulnerability reporting procedures, refer to SECURITY.md.


🤝 Community Gateway & Contributing

We actively welcome contributions, issue reports, tool integrations, and hardware optimizations!


Built with ❤️ by the local-ai-mobile community
Empowering developers to build the next generation of private, on-device intelligence.

Popular repositories Loading

  1. android-inference-engine android-inference-engine Public

    Production-grade, 100% on-device AI inference engine for Android (llama.cpp GGUF, LiteRT NPU/GPU, Gemini Nano AICore).

    Kotlin 1

  2. android-mcp-tools android-mcp-tools Public

    On-device Model Context Protocol (MCP) server & system tool runtime for Android with multi-IPC support.

    Kotlin 1

  3. android-agent-workflow android-agent-workflow Public

    Autonomous on-device agent framework for Android featuring Plan-Execute-Observe-Verify reasoning loops.

    Kotlin 1

  4. .github .github Public

    local-ai-mobile organization profile, architecture map, and community gateway for Android on-device AI.

Repositories

Showing 4 of 4 repositories

People

This organization has no public members. You must be a member to see who’s a part of this organization.

Top languages

Loading…

Most used topics

Loading…