Data as of Sep 17, 2026 · Based on 349 AI responses from ChatGPT Search and Google AI Mode · See how Parse measures this
Building an on-device AI agent for mobile requires choosing between platform-specific performance or cross-platform logic. For iOS, Core ML is the standard for accessing hardware acceleration. For Android,
LiteRT (formerly TensorFlow Lite) is the preferred choice. For teams needing to share core agent logic across both iOS and Android while maintaining native performance, Kotlin Multiplatform stands out as the most recommended approach.
Brands AI recommends here
Named in 60% of answers
The gold standard for iPhone apps. It provides the necessary performance optimization for Apple hardware and the Neural Engine, ensuring your agent runs efficiently with low battery impact.
Named in 41% of answers
Google's primary framework for on-device machine learning. It is best for Android developers needing hardware acceleration, mature API support, and reliable performance on diverse devices.
Named in 34% of answers
Named in 31% of answers
If by **“on-device agent”** you mean a mobile app where a small LLM can reason, call local tools, maintain short-term state, and operate without sending prompts to a server, I’d build around **ExecuTorch** today. ### My recommendation **App layer**
If by “on-device agent” you mean a mobile app where a small LLM can reason, call local tools, maintain short-term state, and operate without sending prompts to a server, I’d build around ExecuTorch today.
App layer
Inference layer
ExecuTorch is explicitly designed for constrained mobile hardware, has a lightweight C++ runtime, and supports Android and iOS. It can target CPU, GPU, NPU and DSP hardware rather than treating the phone as a generic CPU.
For LLMs specifically, its current workflow supports exporting models to .pte and running them through C++, Java/Android, or iOS bindings.
| Framework | Best fit | My take |
|---|---|---|
| ExecuTorch | Cross-platform production mobile AI | Best starting point |
| llama.cpp | Maximum control / broad GGUF ecosystem | Excellent alternative |
| MediaPipe GenAI | Google/Android-oriented apps | Attractive if Android-first |
| Core ML | Apple-only | Excellent if iOS-only |
| MLC-LLM | High-performance LLM deployment | Worth considering for specialized deployments |
The important distinction is that the “agent framework” and the “LLM runtime” shouldn't necessarily be the same thing. I'd keep the agent itself relatively tiny:
┌──────────────────────────────┐
│ Mobile App │
│ │
│ UI ──► Agent Controller │
│ │ │
│ ┌─────┴─────┐ │
│ │ │ │
│ Memory Tools │
│ │ │ │
│ └─────┬─────┘ │
│ │ │
│ Local LLM │
│ (ExecuTorch) │
│ │ │
│ CPU/GPU/NPU │
└─────────────┬────────────────┘
│
No network required
The agent controller can implement a simple loop:
user request
↓
LLM decides:
├── answer directly
├── call local tool
└── ask for clarification
↓
execute tool
↓
feed result back to LLM
↓
final response
That is often preferable to putting a heavyweight cloud-agent framework inside a mobile app.
You can compile away a lot of runtime overhead ahead of time. Its architecture pushes export, optimization, quantization and hardware-specific compilation before deployment, leaving a relatively small runtime on the phone.
On Android, for example, ExecuTorch currently provides XNNPACK for CPU and backends including Vulkan and Qualcomm/MediaTek acceleration. PyTorch Documentation On iOS, it can use Core ML, MPS and XNNPACK; the Core ML backend can dispatch work to Apple's CPU, GPU and Neural Engine.
If you're starting a new project, my default stack would therefore be:
Swift/Kotlin + ExecuTorch + a 1–4B quantized instruct model + a hand-written lightweight tool-calling loop + SQLite/local storage. If you tell me whether you're targeting iOS, Android, or both, and what the agent actually needs to do (e.g. voice assistant, personal productivity, camera/computer vision, offline coding assistant, etc.), I can propose a concrete architecture and model/runtime choices.
The **best approach for building lightweight, on-device mobile AI agents is a hybrid architecture** : use **Kotlin Multiplatform (KMP)** or **React Native combined with Meta's ExecuTorch** to handle local model inference and agent orchestration, paired with **MediaPipe** or **Platform-native APIs** for handling device…
The best approach for building lightweight, on-device mobile AI agents is a hybrid architecture : use Kotlin Multiplatform (KMP) or React Native combined with Meta's ExecuTorch to handle local model inference and agent orchestration, paired with MediaPipe or Platform-native APIs for handling device tools and tasks.
Building an agent entirely on mobile requires solving two distinct problems: running the lightweight model locally and managing agent loops (state, tool calling, execution) without melting the phone's battery or hitting severe memory limits.
| Layer | Best Framework / Tool | Core Function |
|---|---|---|
| Model Inference Engine | ExecuTorch or Google MediaPipe | Runs quantized small language models (SLMs) like Llama 3 8B/3B or Gemma locally on mobile hardware with low memory footprint. |
| Agent Core / Logic | Kotlin Multiplatform (KMP) | Shares the agentic decision loops, state machine, and tool definitions across both iOS and Android without rewriting code. |
| Cross-Platform UI / Bridge | React Native ExecuTorch | Allows JavaScript/TypeScript-heavy teams to manage local inference and UI components seamlessly. |
| Device Tool Integration | Native Android/iOS APIs (CoreML, Local Notifications, Calendars) | Exposes local device sensors, storage, and app actions as executable "tools" for your agent loop. |
If you want to narrow this down, let me know:
Building a mobile app powered by a lightweight, on-device AI agent requires looking at the problem in two layers: the **Inference Engine** (which runs the small language model locally on mobile hardware) and the **Agent Orchestration Framework** (which handles tool use, memory, and multi-step reasoning). Because…
Building a mobile app powered by a lightweight, on-device AI agent requires looking at the problem in two layers: the Inference Engine (which runs the small language model locally on mobile hardware) and the Agent Orchestration Framework (which handles tool use, memory, and multi-step reasoning).
Because on-device models are typically smaller (1B to 4B parameters like Llama-3.2-1B/3B, Gemma-2B, or Phi-3.5-mini), your framework needs to be ruthlessly token-efficient and hardware-optimized.
Before an agent can think or act, you need a high-performance runtime to execute quantized models (𝑄4_𝐾_𝑀 or𝑄8_0 ) locally via CPU/GPU/NPU acceleration.
Standard cloud agent frameworks (like LangChain or CrewAI) are too heavy, memory-hungry, and network-dependent for local mobile execution. For on-device agents, you need lightweight control loops and explicit structured tool use.
To help narrow down the ideal setup, could you share:
For a **lightweight, on-device AI agent**, I would avoid starting with a traditional cloud-agent framework (LangChain, CrewAI, etc.) and instead design a small **agent runtime + local model + native mobile inference stack**. The best choice depends on whether you mean: 1. **A true autonomous agent** (plans, calls…
For a lightweight, on-device AI agent, I would avoid starting with a traditional cloud-agent framework (LangChain, CrewAI, etc.) and instead design a small agent runtime + local model + native mobile inference stack. The best choice depends on whether you mean:
For a true on-device agent, these are the strongest options:
Recommended stack:
The agent itself can be surprisingly small:
User input
↓
Local LLM (1B–7B parameter model)
↓
Planner loop
↓
Tool calls
↓
Local memory (SQLite/vector store)
↓
Action/result
You usually do not need a huge agent framework on-device.
Use when:
Pros:
Cons:
Use when:
Pros:
Cons:
Use when:
Typical stack:
React Native / Swift / Kotlin
|
llama.cpp
|
2B–7B quantized model
|
SQLite + embeddings
Pros:
Cons:
LangGraph is excellent for:
But I would normally keep it server-side, not inside a phone app. Mobile agents benefit from fewer abstractions and tighter resource control.
Best for:
React Native
Great ecosystem
Easy native module integration
Good for AI apps where the heavy work happens in native code
Flutter
Strong UI performance
Good for apps combining AI with rich interfaces
For a startup building an offline-first AI agent app:
React Native
+
Native modules
+
llama.cpp
+
SQLite
+
small quantized LLM
SwiftUI + Kotlin Compose
+
Core ML / LiteRT
+
ExecuTorch
+
local agent loop
PyTorch training
↓
ExecuTorch / ONNX
↓
Native mobile runtime
↓
Custom agent layer
The biggest mistake is choosing an "agent framework" first. For on-device agents, the hard parts are usually model size, memory management, tool permissions, latency, and battery usage, not agent orchestration.
If you share the type of agent you want to build (personal assistant, coding agent, camera agent, health coach, smart home, etc.) and target devices (iOS only vs Android+iOS), I can suggest a more specific stack.
For Android apps, **Android AppFunctions** (backed by the AppFunctions Jetpack library) is the best framework for exposing local app logic as on-device tools for AI agents.[](https://developer.android.com/ai/appfunctions) [[1]](https://developer.android.com/ai/appfunctions) Instead of using heavy server-side…
For Android apps, Android AppFunctions (backed by the AppFunctions Jetpack library) is the best framework for exposing local app logic as on-device tools for AI agents.
Instead of using heavy server-side orchestration, AppFunctions turns your app into an on-device Model Context Protocol (MCP) server. This allows local system agents and assistants (like Google Gemini) to discover and execute your app's functions natively using natural language.
If you'd like, let me know:
I can give you a more specific architecture recommendation!
For a **lightweight, on-device AI agent**, I would not start with a traditional cloud agent framework (LangChain, CrewAI, etc.). Those are optimized for server-side orchestration. A mobile agent needs a stack optimized for: - small language models (SLMs) - low memory usage
For a lightweight, on-device AI agent, I would not start with a traditional cloud agent framework (LangChain, CrewAI, etc.). Those are optimized for server-side orchestration. A mobile agent needs a stack optimized for:
The best choice depends on what you mean by “agent,” but these are the strongest options.
Best if your app targets Apple devices.
Advantages:
For an iPhone-only AI assistant, this is usually the highest-performance route.
Best for Android-native apps.
Advantages:
Google’s current on-device stack centers around LiteRT and ML Kit for running compact models locally.
If you need iOS + Android from one codebase, I’d lean toward:
Flutter is attractive because the UI layer stays simple while heavy AI work can be pushed into native modules. Cross-platform frameworks are increasingly viable for AI apps, but the inference layer still usually belongs in native runtimes.
For a lightweight mobile agent, I would usually avoid a big framework and build something like:
User
|
v
Agent Controller
|
+--> Local LLM
|
+--> Tool Router
| |
| +--> Calendar
| +--> Camera
| +--> Files
| +--> Sensors
|
+--> Memory Store
|
+--> SQLite
+--> Embeddings
The agent controller can be surprisingly small:
A 500–2B parameter model with good tool calling can be more useful on a phone than a much larger model that constantly needs a server connection.
| Runtime | Best for |
|---|---|
| ONNX Runtime Mobile | Cross-platform custom models |
| LiteRT | Android + cross-platform deployment |
| Core ML | Maximum iOS performance |
| llama.cpp | Running quantized LLMs locally |
| MLC LLM | Compiled LLM inference on devices |
Swift/Kotlin native + llama.cpp or platform model APIs
Flutter + LiteRT + local vector database
Native + Core ML / LiteRT + MediaPipe
React Native or Flutter + local LLM runtime
Kotlin Multiplatform + native inference
For a startup wanting speed + quality:
Flutter → native inference plugin → llama.cpp or LiteRT → SQLite vector memory → small quantized instruct model → tool-calling agent loop written in Dart/Kotlin
For a premium iOS product:
SwiftUI + Core ML + Apple’s on-device models
The biggest architectural decision is not the UI framework—it is whether your “agent” is a thin controller around a small local model or a large cloud agent compressed into a phone app. The former is where mobile shines.
If your goal is a **mobile app with a genuinely local AI agent**—LLM inference, tool/function calling, memory, and actions on the phone—I’d build around **ExecuTorch** today. ## My recommendation **Best overall: ExecuTorch + a small quantized LLM + your own agent loop**
If your goal is a mobile app with a genuinely local AI agent—LLM inference, tool/function calling, memory, and actions on the phone—I’d build around ExecuTorch today.
Best overall: ExecuTorch + a small quantized LLM + your own agent loop
ExecuTorch is PyTorch’s purpose-built on-device runtime. It supports Android and iOS, CPU/GPU/NPU/DSP acceleration, quantization, and LLMs, while keeping the runtime extremely small. Its current documentation specifically includes LLM export/deployment and Swift/Java bindings.
A practical architecture would be:
┌─────────────────────────────────┐
│ Mobile App │
│ Swift / Kotlin │
├─────────────────────────────────┤
│ Agent Runtime │
│ │
│ Planner → Tool Calls → Memory │
│ ↕ ↕ │
│ Context App Actions │
├─────────────────────────────────┤
│ ExecuTorch │
│ quantized local LLM │
├─────────────────────────────────┤
│ CPU / GPU / NPU │
└─────────────────────────────────┘
The important distinction is that ExecuTorch is the inference/runtime layer, not a complete agent framework. I'd keep the agent orchestration relatively thin and write it yourself rather than putting a heavyweight cloud-agent framework inside the phone.
| Framework | Best for | My take |
|---|---|---|
| ExecuTorch | Production mobile + custom models | ⭐ My first choice |
| MLC LLM | Getting an LLM running on iOS/Android quickly | ⭐ Excellent alternative |
| llama.cpp | Maximum control, broad GGUF ecosystem | Excellent for power users |
| Core ML | Apple-only apps | Great if Android isn't needed |
| ONNX Runtime | Existing ONNX model ecosystem | Less compelling specifically for LLM agents |
MLC LLM is particularly attractive if your priority is "I want a local LLM working on both iOS and Android with a relatively straightforward API." It provides a unified MLCEngine and OpenAI-compatible interfaces across platforms, including iOS and Android.
ExecuTorch's advantage is that it's more than an LLM runner: you can eventually combine your language model with local vision, speech, classifiers, and other models under the same edge-oriented stack. It also has hardware-specific backends and AOT compilation.
I'd start with:
For example:
User: "Remind me to call Sarah when I get home."
↓
Local LLM
↓
intent = create_reminder
↓
tool call
↓
OS Reminder API
↓
"Done — I'll remind you when you get home."
The agent itself doesn't need to be a huge framework. The model decides what to do; deterministic application code should actually do it. That's especially important on mobile for reliability, battery usage, permissions, and security.
ExecuTorch already provides LLM runners for Android and iOS, including Kotlin/Java and Swift interfaces.
If you tell me iOS only vs. iOS + Android, and roughly what the agent needs to do (e.g. personal assistant, offline coding assistant, voice agent, photo agent, app automation), I can recommend a specific model + runtime + agent architecture and estimate the RAM/storage requirements.
┌─────────────────────────────────┐
│ Mobile App │
│ Swift / Kotlin │
├─────────────────────────────────┤
│ Agent Runtime │
│ │
│ Planner → Tool Calls → Memory │
│ ↕ ↕ │
│ Context App Actions │
├─────────────────────────────────┤
│ ExecuTorch │
│ quantized local LLM │
├─────────────────────────────────┤
│ CPU / GPU / NPU │
└─────────────────────────────────┘
The important distinction is that ExecuTorch is the inference/runtime layer, not a complete agent framework. I'd keep the agent orchestration relatively thin and write it yourself rather than putting a heavyweight cloud-agent framework inside the phone.
| Framework | Best for | My take |
|---|---|---|
| ExecuTorch | Production mobile + custom models | ⭐ My first choice |
| MLC LLM | Getting an LLM running on iOS/Android quickly | ⭐ Excellent alternative |
| llama.cpp | Maximum control, broad GGUF ecosystem | Excellent for power users |
| Core ML | Apple-only apps | Great if Android isn't needed |
| ONNX Runtime | Existing ONNX model ecosystem | Less compelling specifically for LLM agents |
MLC LLM is particularly attractive if your priority is "I want a local LLM working on both iOS and Android with a relatively straightforward API." It provides a unified MLCEngine and OpenAI-compatible interfaces across platforms, including iOS and Android.
When building a mobile application powered by an on-device AI agent, the "best" framework depends entirely on whether you are looking for the underlying **hardware inference engine** (to run the LLM locally) or the **agent orchestration layer** (to handle loops, states, and tools). The optimal modern stack relies on…
When building a mobile application powered by an on-device AI agent, the "best" framework depends entirely on whether you are looking for the underlying hardware inference engine (to run the LLM locally) or the agent orchestration layer (to handle loops, states, and tools).
The optimal modern stack relies on PyTorch ExecuTorch or Google's MediaPipe / Google ADK for ultra-fast, hardware-accelerated local inference, seamlessly paired with LangGraph for lightweight state management.
These frameworks allow lightweight open-source models—such as Google's Gemma family or Meta's Llama 3.2 1B/3B—to execute directly on a phone's hardware (NPU/GPU).
React Native ExecuTorch allow mobile developers to trigger on-device LLMs inside popular cross-platform environments.On-device agents require loop-based reasoning, custom tools, and strict data tracking. Traditional agent frameworks like CrewAI or AutoGen are usually too bloated for mobile runtime environments.
Recommended Structural Stack Comparison
| Tier | Apple-Centric Stack | Cross-Platform Stack (React Native/Flutter) | Android-Centric Stack |
|---|---|---|---|
| Inference Engine | Core ML | ExecuTorch | MediaPipe / TensorFlow Lite |
| Agent Logic | LangGraph (via Python/JS bindings) | LangGraph JS | Google ADK |
| Recommended Model | Llama 3.2 (1B / 3B quantized) | Llama 3.2 or Gemma 2B | Gemma 2B / 7B quantized |
Essential Implementation Tips
To help narrow this down, what programming language or framework (Swift, Kotlin, React Native, Flutter) is your mobile app built on? Also, what specific actions or tasks do you want this agent to execute on-device?
Gemma
The best frameworks for building lightweight, on-device AI agents on mobile are **Google MediaPipe** and **TensorFlow Lite** paired with platform-native toolkits like MediaPipe LLM Inference for running local models (like Gemma or Llama Nano) completely offline.[](https://www.youtube.com/watch?v=sFCr3qL-gcM&t=1077)…
The best frameworks for building lightweight, on-device AI agents on mobile are Google MediaPipe and TensorFlow Lite paired with platform-native toolkits like MediaPipe LLM Inference for running local models (like Gemma or Llama Nano) completely offline.
Top Frameworks for On-Device Mobile Agents
| Framework | Core Advantage | Best Use Case |
|---|---|---|
| Google MediaPipe | Optimized cross-platform on-device execution with built-in LLM and vision task support. | Real-time multimodal tasks, local chat, and on-device agent logic on iOS & Android. |
| TensorFlow Lite (TFLite) | Mature, highly lightweight runtime optimized for lower-end hardware and custom micro-models. | Running custom-trained predictive models, embeddings, and lightweight classification. |
| ExecuTorch (PyTorch) | Enables efficient execution of PyTorch models directly on mobile edge devices. | Developers transitioning PyTorch-trained agent policies and small language models to mobile. |
| Ollama / Llama.cpp (Ported) | High-performance C/C++ inference tailored for running quantized open weights locally. | Power-user local execution on high-end smartphones with larger context windows. |
Key Ingredients for Mobile Agent Architecture
If you tell me which mobile platform (iOS, Android, or cross-platform like Flutter/React Native) you are targeting and what tasks the agent needs to perform , I can recommend a precise technical stack and model size.
If your goal is a **mobile app with a genuinely lightweight, autonomous on-device agent**, my current first choice would be **ExecuTorch**. It’s not an “agent framework” in the same sense as LangChain or OpenAI Agents SDK. Instead, it gives you the **small, optimized model runtime underneath your agent**, while you…
If your goal is a mobile app with a genuinely lightweight, autonomous on-device agent, my current first choice would be ExecuTorch.
It’s not an “agent framework” in the same sense as LangChain or OpenAI Agents SDK. Instead, it gives you the small, optimized model runtime underneath your agent, while you implement the agent loop yourself. That distinction is important for mobile.
Mobile app
On-device model
Agent layer
User
↓
Agent controller
├── short-term state
├── tool selection
├── planning / reasoning
└── safety / permissions
↓
Local LLM
↓
Tools
├── filesystem
├── contacts
├── calendar
├── camera
├── location
└── your app's APIs
The agent controller itself can be ordinary Swift/Kotlin code. You don't necessarily want another heavyweight framework sitting between your app and the model.
It is specifically designed for constrained edge devices and supports Android and iOS, with CPU, GPU, NPU and DSP acceleration.
For Android, it provides Java/Kotlin integration through an AAR, and supports XNNPACK, Vulkan, Qualcomm and MediaTek backends. PyTorch Documentation On iOS, it provides Swift/Objective-C integration and Core ML/MPS/XNNPACK backends.
It also has explicit LLM deployment tooling, including quantization and model export, rather than being merely a generic tensor runtime.
And importantly for your use case, the runtime is deliberately designed to push work into ahead-of-time compilation so the device-side runtime stays lightweight.
I wouldn't start with:
LangChain/LangGraph + a local LLM
They're excellent for server-side agents, but on mobile I'd rather have:
YOUR AGENT
│
┌─────────┴─────────┐
│ │
Agent state Tool router
│ │
└─────────┬─────────┘
│
ExecuTorch LLM
│
┌────────┴────────┐
│ │
NPU/GPU CPU
This gives you much more control over RAM, battery, latency, model size and privacy.
If you're building an agent rather than simply a chatbot, the model runtime is only half the problem.
The interesting engineering is the agent loop:
while not finished:
observation = get_state()
action = model.generate(
system_prompt,
conversation,
observation,
available_tools
)
if action.tool_call:
result = execute_tool(action)
conversation.append(result)
else:
return action.response
I'd make tool calls strongly typed, permissioned, and deterministic wherever possible. Let the LLM decide what to do, but don't let it directly manipulate arbitrary native APIs.
| Approach | Mobile | Lightweight | LLMs | Agent control | My take |
|---|---|---|---|---|---|
| ExecuTorch | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | Best overall |
| llama.cpp | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | Excellent if you want maximum model/runtime control |
| ONNX Runtime Mobile | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐⭐ | Great general-purpose inference |
| Core ML | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐ | Best if iOS-only |
| MediaPipe/LiteRT | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐ | Strong Google/Android-oriented option |
If you're targeting both iOS and Android, I'd prototype with ExecuTorch. If you're targeting iOS only, I'd seriously consider Core ML directly. If you tell me (1) iOS, Android, or both, (2) your target phone age, and (3) what the agent actually needs to do, I can recommend the specific model + runtime + agent architecture I'd use.