How to Build a Kotlin AI Agent with Google ADK 1.6

How to Build a Kotlin AI Agent with Google ADK 1.6

Google’s Agent Development Kit for Kotlin helps developers build AI agents for the JVM and Android. This guide creates an agent that answers time questions through a custom Kotlin tool.

What ADK Kotlin provides

ADK is a framework for agents that use models, tools, sessions, memory, and multi-agent workflows. Google released ADK for Kotlin 1.0 on September 9, 2026. The project publishes releases through Maven Central. The current installation guide uses version 1.6.0. Google’s launch announcement describes its Kotlin, Java, and Android support.

The Kotlin package supports custom tools through @Tool and @Param annotations. Kotlin Symbol Processing, or KSP, generates tool registration code during compilation. This approach avoids runtime reflection for these functions. The release notes list multi-agent systems, resumable sessions, confirmation flows, and Android model backends.

Create the Gradle project

The official quickstart requires Java 17 or later. It also requires Gradle 8.0 or later. Create a standard Kotlin application project. Then add the ADK libraries to build.gradle.kts.

plugins {
    kotlin("jvm") version "2.1.20"
    id("com.google.devtools.ksp") version "2.1.20-2.0.1"
    application
}

repositories {
    mavenCentral()
}

dependencies {
    implementation("com.google.adk:google-adk-kotlin-core:1.6.0")
    implementation("com.google.adk:google-adk-kotlin-webserver:1.6.0")
    ksp("com.google.adk:google-adk-kotlin-processor:1.6.0")
}

kotlin {
    jvmToolchain(17)
}

application {
    mainClass.set("com.example.agent.MainKt")
}

The core library contains the agent runtime. The processor generates code for annotated tools. The webserver library adds a local development interface. The official installation guide lists the current Kotlin dependencies.

Add a callable Kotlin tool

A tool is a normal function that an agent may call. This example returns the current time for a named city. It uses Java’s time-zone database.

package com.example.agent

import java.time.ZoneId
import java.time.ZonedDateTime
import com.google.adk.kt.annotations.Param
import com.google.adk.kt.annotations.Tool

class TimeService {
    @Tool(description = "Returns the current time for a city.")
    fun getCurrentTime(
        @Param(description = "An IANA time-zone ID such as America/New_York")
        city: String
    ): String {
        val zone = ZoneId.of(city)
        return ZonedDateTime.now(zone).toString()
    }
}

The function expects an IANA time-zone ID. Examples include America/New_York and Europe/London. The model can select this function when a user asks for a time.

Define and run the agent

Next, create HelloTimeAgent.kt. Connect the time tool to a Gemini model. The API key comes from the GOOGLE_API_KEY environment variable. Google’s quickstart recommends creating that key in Google AI Studio. The Kotlin quickstart documents the environment setup.

package com.example.agent

import com.google.adk.kt.agents.Instruction
import com.google.adk.kt.agents.LlmAgent
import com.google.adk.kt.models.Gemini

object HelloTimeAgent {
    val rootAgent = LlmAgent(
        name = "hello_time_agent",
        description = "An assistant that tells the current time.",
        model = Gemini(
            name = "gemini-flash-latest",
            apiKey = System.getenv("GOOGLE_API_KEY")
                ?: error("GOOGLE_API_KEY is not set")
        ),
        instruction = Instruction(
            "Use getCurrentTime for time questions. " +
                "Ask for a city when the time zone is unclear."
        ),
        tools = TimeService().generatedTools()
    )
}

Add a simple entry point in Main.kt. ADK’s ReplRunner provides an interactive terminal session.

package com.example.agent

import com.google.adk.kt.runners.ReplRunner

fun main() {
    ReplRunner(HelloTimeAgent.rootAgent).start()
}

Run the application with Gradle. Ask, “What time is it in New York?” The agent should call the tool and return its result.

./gradlew run

Test through the development UI

ADK also includes a local web interface. Create WebMain.kt and add the development server configuration.

package com.example.agent

import com.google.adk.kt.webserver.AdkServerConfig
import com.google.adk.kt.webserver.dev.AdkDevServer

fun main() {
    val server = AdkDevServer(
        AdkServerConfig.inMemory(HelloTimeAgent.rootAgent)
    )
    server.start(wait = true)
}

Start this entry point with the matching Gradle property. Then open http://localhost:8080 in a browser. The in-memory configuration keeps sessions inside the running process. It does not provide durable storage.

Google says the ADK web interface is for development and debugging. Do not expose it as a production service. For deployment, use the API server. Add authentication before accepting remote requests. The ADK Kotlin repository documents server options, Android backends, telemetry, and examples.

Next design choices

This small agent shows the basic pattern. Add tools for useful work. Place sensitive actions behind confirmation checks. Use persistent session services when conversations must survive restarts.

Android developers can use cloud Gemini through Firebase AI Logic. They can also use LiteRT-LM or Gemini Nano on the device. The available features differ. ML Kit Gemini Nano does not currently support tool calling, according to the project documentation.

References

Google Developers Blog. (2026, September 9). Announcing ADK for Kotlin 1.0: Building production-ready AI agents in Kotlin, Android, and beyond. https://developers.googleblog.com/announcing-adk-for-kotlin-10-building-production-ready-ai-agents-in-kotlin-android-and-beyond/

Google. (n.d.). Installation. Agent Development Kit. Retrieved November 25, 2026, from https://adk.dev/get-started/installation/

Google. (n.d.). Kotlin quickstart for ADK. GitHub. Retrieved November 25, 2026, from https://github.com/google/adk-docs/blob/main/docs/get-started/kotlin.md

Google. (n.d.). ADK for Kotlin. GitHub. Retrieved November 25, 2026, from https://github.com/google/adk-kotlin

Google. (n.d.). Releases: google/adk-kotlin. GitHub. Retrieved November 25, 2026, from https://github.com/google/adk-kotlin/releases