Getting Started

The ADK provider brings on-device Gemini Nano to Android React Native apps through Google's Agent Development Kit (ADK) and the Vercel AI SDK. Gemini Nano runs locally via ML Kit GenAI - provisioned by the Android system through AICore, with no API key and no model files to bundle. You also get cloud Gemini as an option when you need a larger model or broader device support.

Installation

Install the ADK provider:

npm
yarn
pnpm
bun
npm install @react-native-ai/adk

While you can use the ADK provider standalone, we recommend using it with the Vercel AI SDK for a much better developer experience. The AI SDK provides unified APIs, streaming support, and advanced features. To use with the AI SDK, you'll need v5+ and required polyfills:

npm
yarn
pnpm
bun
npm install ai

Requirements

  • Android only - The provider is not available on iOS or web
  • Android minSdkVersion 26 or greater - Required by ML Kit GenAI / Gemini Nano
  • React Native New Architecture - Required for native module functionality
  • React Native >= 0.76.0
  • Gemini Nano - A physical Android device with AICore support (Android 14+). See the ML Kit GenAI documentation for device support details.
Gemini Nano - physical supported device required

Gemini Nano requires a physical Android device with AICore support and support for the Gemini Nano models. Please consult the ML Kit GenAI documentation.

Cloud Gemini works on all devices supported by ADK & MLKit when an API key is configured.

Integration with your app

Consuming apps must set minSdkVersion to at least 26. ADK pulls in Google GenAI libraries that duplicate META-INF/INDEX.LIST; exclude it in your app packaging via expo-build-properties:

Expo Setup

{
  "expo": {
    "plugins": [
      [
        "expo-build-properties",
        {
          "android": {
            "minSdkVersion": 26,
            "packagingOptions": {
              "exclude": ["META-INF/INDEX.LIST", "META-INF/DEPENDENCIES"]
            }
          }
        }
      ]
    ]
  }
}

After changing CNG config, run:

npx expo prebuild --clean

Bare React Native

Add the following to android/app/build.gradle:

android {
  packagingOptions {
    excludes += ["META-INF/INDEX.LIST", "META-INF/DEPENDENCIES"]
  }
}

Ensure your app's minSdkVersion is at least 26.

Available Model Types

Model TypemodelTypeDefault NameUse Case
On-device Gemini Nanogenai-nanogemini-nanoPrivate, offline-capable inference - system-provisioned via AICore
Cloud Geminigeminigemini-2.5-flashCloud inference via Google AI API

Basic Usage

Import the default ADK provider and call adk() to construct a language model, then pass it to the AI SDK. The default export targets on-device Gemini Nano (gemini-nano):

import { adk } from '@react-native-ai/adk'
import { generateText } from 'ai'

const supported = await adk.isNanoSupported()
if (!supported) throw new Error('Gemini Nano not supported on this device')

const ready = await adk.isAvailable()
if (!ready) throw new Error('Gemini Nano not ready yet')

await adk.prepareNano()

const { text } = await generateText({
  model: adk(),
  prompt: 'Summarize on-device AI in one sentence.',
})

See Cloud Gemini when you need cloud inference instead.

On-device Gemini Nano

Gemini Nano runs locally via ML Kit GenAI and is provisioned by the Android system (AICore). The default adk() export already targets Nano — check availability and prepare before generating:

import { adk } from '@react-native-ai/adk'
import { generateText } from 'ai'

const supported = await adk.isNanoSupported()
if (!supported) throw new Error('Gemini Nano not supported on this device')

const ready = await adk.isAvailable('genai-nano')
if (!ready) throw new Error('Gemini Nano not ready yet')

await adk.prepareNano()

const { text } = await generateText({
  model: adk(),
  prompt: 'Summarize on-device AI in one sentence.',
})

To customize the system instruction or register tool executors, create a provider with createAdkProvider:

import { createAdkProvider } from '@react-native-ai/adk'
import { generateText } from 'ai'

const adk = createAdkProvider({
  modelType: 'genai-nano',
  modelName: 'gemini-nano',
  instruction: 'You are a helpful assistant.',
})

await adk.prepareNano()

const { text } = await generateText({
  model: adk(),
  prompt: 'Summarize on-device AI in one sentence.',
})

Availability Check

Nano has two separate checks:

APILabelQuestion
adk.isNanoSupported()Device capabilityCan this device ever run Nano?
adk.isAvailable('genai-nano')Runtime readinessCan I call prepareNano() / generate now?

If isNanoSupported() is false, isAvailable('genai-nano') is also false.

Both checks are cheap native calls (no model download), safe to cache at app startup and re-check after resume.

Both checks use ML Kit Generation.getClient().checkStatus():

StatusisNanoSupported()isAvailable('genai-nano')Suggested UX
0falsefalseHide or disable - not supported
1truetrueReady - call prepareNano()
3truetrueReady to download - call prepareNano()
Other non-zerotruefalseShow disabled - not ready yet

If needed, consult the ML Kit GenAI Prompt API for details.

import { adk } from '@react-native-ai/adk'

const supported = await adk.isNanoSupported()
if (!supported) {
  // Device lacks Gemini Nano / AICore support - hide from model picker
  return
}

const ready = await adk.isAvailable('genai-nano')
if (!ready) {
  // Device supports Nano but ML Kit is not ready yet (e.g. downloading)
  // Show disabled - do not mark as "Ready"
  return
}

await adk.prepareNano()
const model = adk()

Automatic Preparation

model.prepare(), generateText(), and streamText() auto-call prepareNano() for genai-nano models, but only gate on isNanoSupported(). For UI gating, always use isAvailable('genai-nano') and handle prepare/generation errors in your chat flow.

import { adk } from '@react-native-ai/adk'
import { generateText } from 'ai'

const model = adk()

// Explicit prepare (initializes Nano via ML Kit)
await model.prepare()

// Or let generation trigger prepare automatically
await generateText({ model, prompt: 'Hello!' })

Cloud Gemini

When you need cloud inference - for example on emulators or devices without AICore - create a provider with modelType: 'gemini' and an API key:

import { createAdkProvider } from '@react-native-ai/adk'
import { generateText } from 'ai'

const adk = createAdkProvider({
  apiKey: process.env.GOOGLE_API_KEY,
  modelType: 'gemini',
  modelName: 'gemini-2.5-flash',
})

const { text } = await generateText({
  model: adk(),
  prompt: 'What time is it in New York?',
})

To customize the system instruction or cloud model name:

import { createAdkProvider } from '@react-native-ai/adk'
import { generateText } from 'ai'

const adk = createAdkProvider({
  apiKey: process.env.GOOGLE_API_KEY,
  modelType: 'gemini',
  modelName: 'gemini-2.5-flash',
  instruction: 'You are a helpful assistant.',
})

const { text } = await generateText({
  model: adk(),
  prompt: 'What time is it in New York?',
})

Do not embed API keys in production client apps. Prefer a backend proxy or secure runtime configuration.

Cloud models do not require a separate download or prepare step.

Custom provider (advanced)

Use createAdkProvider when you need to change the model type, agent name, system instruction, API key, or registered tool executors. It returns the same callable interface as the default adk export - call it to construct a language model:

const adk = createAdkProvider({
  name: 'my_agent',
  description: 'A helpful assistant',
  instruction: 'You are a concise, friendly assistant.',
  modelType: 'genai-nano',
  modelName: 'gemini-nano',
})

const model = adk()
// or
const model = adk.languageModel()

Provider Options

OptionTypeDescription
namestringADK agent name (default: react_native_adk_agent)
descriptionstringAgent description shown to ADK
instructionstringSystem instruction for the agent
modelType'genai-nano' | 'gemini'On-device or cloud backend (default: genai-nano)
modelNamestringModel identifier (default: gemini-nano; use gemini-2.5-flash for cloud)
apiKeystringGoogle AI API key - required for cloud gemini only
availableToolsRecord<string, Tool>Tools whose execute handlers ADK can call from JavaScript

Next Steps

See Generating for text generation, streaming, tool calling and multimodal input.

Need React or React Native expertise you can count on?

Need help with React or React Native projects?
We support teams building scalable apps with React and React Native.