ADK for Android: Build Private AI Agents on 140M+ Devices

ADK for Android: Build Private AI Agents on 140M+ Devices

Following the significant 1.0.0 releases of ADK for Java and Go, and the beta of ADK for Python 2.0, we are thrilled to announce the launch of version 0.1.0 of the Agent Development Kit (ADK) for Kotlin! Alongside this, we’re also introducing a specialized library designed specifically for mobile: ADK for Android.

ADK is a versatile and open-source framework engineered for developing and running sophisticated AI agents. Its availability in Kotlin extends its reach to a broader developer base, empowering backend projects with advanced agentic workflows. The Android version takes this innovation directly to users’ pockets, enabling AI agents to operate on-device within your applications.

Why On-Device AI Matters More Than Ever

The AI landscape is rapidly shifting towards the edge, a trend significantly amplified by the introduction of Gemini Nano. Now available on over 140 million Android devices, Gemini Nano exemplifies the massive potential of on-device AI.

Developers are increasingly seeking ways to build applications that are faster, more cost-effective, and prioritize user privacy. The ability to run AI models directly on mobile hardware, like Gemini Nano, is crucial for achieving these goals. However, orchestrating complex agentic systems that span both cloud and edge environments can be challenging; ADK simplifies this by managing the intricate orchestration, context handling, and error handling for you.

ADK for Android: Intelligent Apps, Enhanced Privacy

ADK for Android is specifically optimized for on-device operations, allowing you to create AI agents that utilize local LLMs. This approach significantly enhances privacy by keeping sensitive data on the device, while offering the flexibility to seamlessly bridge interactions with cloud-based models when needed.

During our recent I/O session, we proudly showcased how ADK for Kotlin powers an in-app trip assistant, demonstrating these hybrid capabilities. Imagine a user facing a travel issue: a cloud-based orchestrator interacts with them to understand the problem, but when it needs to verify a booking confirmation, it intelligently delegates this sensitive task to an on-device subagent.

This subagent then uses Gemini Nano to extract data from locally stored documents, like emails or boarding passes, ensuring private information never leaves the device. Finally, a validation agent compares this extracted data, leveraging the reasoning capabilities of the cloud orchestrator while maintaining local data integrity. To integrate ADK into your Android app, simply add the following dependency to your build.gradle.kts file:

  • implementation("com.google.adk:google-adk-kotlin-core-android:0.1.0")

You can then easily define your ADK agents, like this orchestrator example:

val orchestrator = LlmAgent(
    name = "genius_orchestrator",
    model = Gemini(apiKey = apiKey, name = MODEL_NAME),
    instruction = Instruction("""
        You are a travel genius assistant. First, use `get_trip_details` to get the full itinerary of the trip and understand what events are scheduled. Then, respond with a welcome message tailored to the trip state.
    """.trimIndent()),
    tools = listOf(GetTripDetailsTool(tripId)),
    subAgents = listOf(carRentalPipeline, hotelPipeline),
    disallowTransferToPeers = true,
    disallowTransferToParent = true,
)

ADK for Kotlin: Building Powerful Backend Agents

ADK for Kotlin empowers developers to define sophisticated agentic workflows directly within their backend projects. This capability allows your services to orchestrate complex tasks, integrate various tools, and even delegate responsibilities to sub-agents, transforming how applications interact with AI models.

To get started, add these dependencies to your build.gradle.kts file:

  • implementation("com.google.adk:google-adk-kotlin-core:0.1.0")
  • ksp("com.google.adk:google-adk-kotlin-processor:0.1.0")

ADK for Kotlin allows you to define custom tools, effectively equipping your LLMs with extra capabilities. For instance, inspired by science fiction, let’s create an “improbability drive” service:

class ImprobabilityDriveService {
    /** Calculates the improbability of a given event. */
    @Tool fun calculateImprobability(
        @Param("The event to calculate the improbability for, e.g., 'A cup of tea materializing'") event: String
    ): String {
        return "The improbability of '$event' is approximately 42 to 1 against."
    }
}

Notice how the @Tool and @Param annotations clearly describe the tool’s function to the LLM. We can then define a sub-agent, like the `HeartOfGold` spaceship computer, utilizing this new tool:

val heartOfGoldAgent = LlmAgent(
    name = "HeartOfGold",
    description = "The Heart of Gold ship computer. Handles improbability drive queries.",
    model = Gemini(apiKey = apiKey, name = "gemini-2.5-flash"),
    instruction = Instruction(
        """ You are the ship computer of the Heart of Gold. You are cheerful, helpful, and slightly annoying. You have access to the Infinite Improbability Drive. Use real facts about yourself if asked, but keep it funny. """
            .trimIndent()
    ),
    tools = ImprobabilityDriveService().generatedTools()
)

Finally, we can integrate this sub-agent into a root agent, such as `MissionControl`, which handles routing queries. This demonstrates how a main agent can delegate specific tasks, like calculating improbability, to specialized sub-agents, creating a robust and modular agent system.

val rootAgent = LlmAgent(
    name = "MissionControl",
    description = "The central router for space queries. Routes to HeartOfGold.",
    subAgents = listOf(heartOfGoldAgent),
    model = Gemini(apiKey = apiKey, name = "gemini-2.5-flash"),
    instruction = Instruction(
        """ You are Mission Control. You are the central hub for all communications. Your main job is to route the user's query to the most appropriate agent. - If the query is about improbability, the Infinite Improbability Drive, or the Heart of Gold, transfer to `HeartOfGold`. - Otherwise, respond directly with a professional but stressed persona. """
            .trimIndent()
    )
)

When a user asks about the improbability of an event, the `MissionControl` agent intelligently delegates the request to the `heartOfGoldAgent`. This sub-agent then calls the local function tool to calculate the probability before formulating its reply, showcasing a simple yet powerful example of tool and sub-agent definition in ADK for Kotlin.

Looking Ahead: The Future of In-App AI

The ADK for Kotlin & ADK for Android 0.1.0 releases provide a foundational feature set for building sophisticated AI agents across Android and backend environments. These include advanced control over agent execution, comprehensive tooling, and essential services for state management.

As our first experimental version, this library currently features default agents for the ML Kit GenAI APIs and direct connections to Gemini in the Cloud. This is just the beginning of our journey.

We are incredibly excited about the future of in-app AI and eagerly anticipate the intelligent experiences you will build with ADK. Be sure to check out the project on GitHub to explore the possibilities!

Source: Google Developers Blog

Kristine Vior

Kristine Vior

With a deep passion for the intersection of technology and digital media, Kristine leads the editorial vision of HubNextera News. Her expertise lies in deciphering technical roadmaps and translating them into comprehensive news reports for a global audience. Every article is reviewed by Kristine to ensure it meets our standards for original perspective and technical depth.

More Posts - Website

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top