This guide helps you find the right AI/ML solution for your use case. It provides guidance to help you navigate the various solutions available and choose the one that best fits your needs, given the requirements of the feature you want to implement.
In general, when choosing tools and models to implement your AI/ML feature, you should use the simplest model that fulfills your needs. To identify the optimal solution, you need to think through the following:
- Does the feature need to generate new content (generative AI), or predict/categorize in a deterministic way (traditional ML)?
- Feature scope: can the task be done entirely within your app (in-app intelligence), or does it require multiple apps to accomplish (system-level intelligence)?
- Model location: can the task be done offline (on-device model), or does it require interacting with a server (cloud-based model)?
- Toolkit or model version: how complex is the task, ranging from simple, single-inference tasks to multi-agent orchestration?
The following flow chart shows the decision process at a high level:
To inform your decision at each step, refer to sections in the rest of this document.
Generative AI versus traditional ML
Generative AI models create new content, whereas traditional ML models predict outcomes or categorize data in a completely deterministic manner. If your feature doesn't involve generating new content, then traditional ML solutions might be sufficient. The following table summarizes some traditional ML solutions:
| Toolkit / Solution | Type | Primary use case | Examples |
|---|---|---|---|
| ML Kit SDK | On-device | Pre-built vision and natural language processing tasks |
|
| LiteRT | On-device | Custom model runtimes |
|
| MediaPipe | On-device | Real-time video or audio stream perception tasks |
|
| Google Cloud APIs including Cloud Vision API and Cloud Natural Language API | Cloud-based | Pre-built vision and natural language processing tasks |
|
| Agent Platform | Cloud-based | End-to-end custom model training and deployment |
|
The rest of this document is about generative AI solutions.
In-app versus system-level intelligence
To identify the best generative AI solution, decide whether your AI feature works entirely within your app or if it requires interacting with other apps or the Android OS, outside of any app. If your feature is triggered by the system, outside of any app, then it counts as system-level intelligence. The following table summarizes the differences between in-app and system-level intelligence features:
| In-app intelligence | System-level intelligence | |
|---|---|---|
| Task scope | In-app | Across apps (or triggered by the system, outside any app) |
| Tools | ML Kit SDK, LiteRT, Firebase AI Logic, or self-hosted backend | AppFunctions |
| Use cases |
|
|
In-app intelligence
In-app intelligence features don't need to interact with other apps or the system beyond the app. Once you determine that your AI feature is entirely in-app, you need to decide whether you can run the feature completely on-device, use a cloud-based model, or do a hybrid approach that combines both.
If you're doing anything that requires video input or tasks that involve multiple agents, then you should use a cloud-based model. The following table compares the capabilities of on-device versus cloud-based models:
| On-device | Cloud | |
|---|---|---|
| Tools | ML Kit SDK or LiteRT | Firebase AI Logic or self-hosted backend |
| Input type |
|
|
| Output type |
|
|
| User data sensitivity | Higher | Lower |
| Models |
|
|
| Use cases |
|
|
On-device models
On-device models are probably preferable if any of the following apply:
- Cost constraints
- Feature must be able to run offline
- Privacy requirements
- The task at hand is relatively simple—it doesn't require multi-agent orchestration
Keep in mind that your users' devices must be able to support on-device models. On-device models typically require more premium devices that can support the local processing.
Once you've determined that on-device models are sufficient for your feature, the optimal toolkit or solution depends primarily on the task complexity. The following table summarizes the options for on-device, in-app generative AI tooling:
| Task complexity | Feature characteristics | Example | Toolkit/Solution |
|---|---|---|---|
| Low |
|
Summarize text |
|
| Medium |
|
Query and response | |
| High |
|
Customer feedback or bug triage |
Use the ML Kit Prompt API for straightforward single-turn or multi-turn
conversational text generation. When your feature requires autonomous,
multi-step execution on-device, use the ML Kit GenAI Agent API. The Agent API
supports on-device reasoning loops that can plan, invoke typed tools using
@Tool annotations, persist session context across interactions, and enforce
turn limits using maxTurns.
Cloud-based models
If your feature can't be run entirely on-device, you need to use a cloud-based model. There are two main options for how to use a cloud-based model:
Managed backend using Firebase AI Logic. If you're already a Firebase user or want to prototype something relatively quickly, Firebase AI Logic is probably the best solution.
Custom backend, or self-hosted server. If you want to use non-Gemini models, have strict privacy requirements, or need to complete a very complex task, you probably need to use a custom backend. We also recommend the following tools for the custom backend setup:
- Have your custom backend run an agentic framework such as Agent Development Kit
- Connect the app frontend to the agentic backend using AG-UI
- Enable agents to generate rich, interactive UIs using A2UI
The following table summarizes when to use Firebase AI Logic or a custom backend for cloud-based, in-app generative AI tooling:
| Task complexity | Feature characteristics | Example | Toolkit/Solution |
|---|---|---|---|
| Low |
|
Summarize text |
|
| Medium |
|
Query and response |
|
| High |
|
Customer feedback or bug triage |
|
| Very high |
|
Create an agent team for managing different aspects of a trip |
|
Hybrid approach
Use a hybrid approach when your feature can run locally, but not all of your users have devices that support on-device models and you need to use cloud models as a fallback. For more information, see Hybrid inference.
System-level intelligence
System-level intelligence enables the Android platform to act as a task orchestrator. System-level intelligence enables system agents, such as Gemini, to complete user requests across multiple apps and web services.
To connect your app with the Android intelligence system, choose an integration method based on whether you want programmatic control or automated UI-driven actions:
| Integration option | Use case |
|---|---|
| AppFunctions | Make specific capabilities on your app available for agents to discover and execute on-device. |
| Remote MCP server | Make specific capabilities on your app available to integrate directly with the agent's backend. Good for cross-platform development. |
| Computer Control | Allows an OEM-preloaded assistant to automate tasks by interacting directly with an app's UI. |
For more information on system-level intelligence tooling options, see Connect your app to the Android intelligence system.