Building AI Agents with the Kotlin Agent Development Kit (ADK) A developer built a starter 'Hello World' AI agent using Kotlin and Google's native Kotlin Agent Development Kit (ADK). The agent uses Gemini to decide when to call a tool discovered from a local Kotlin Model Context Protocol (MCP) server, showcasing static typing benefits for agent configuration. This tutorial builds a starter "Hello World" style agent using Kotlin and the native Kotlin version of the Agent Development Kit ADK . The full sample project is available on GitHub: This project is a runnable Kotlin Agent Development Kit ADK demo. A Kotlin LlmAgent uses Gemini to decide when to call a greet tool discovered from a local Kotlin Model Context Protocol MCP server. The project has two Gradle modules: agent : the Kotlin ADK agent, Gemini model configuration, MCP toolset, and interactive ReplRunner ; server : the Ktor MCP server that exposes greet . com.google.adk:google-adk-kotlin-core v0.6.0 io.modelcontextprotocol:kotlin-sdk-jvm v0.8.1 The Gradle wrapper is included. Create the local environment file: cp .env.example .env Set GOOGLE API KEY in .env , then load it: source ./set env.sh The file is ignored by Git. Start the Kotlin MCP server in one… Kotlin is a modern, statically typed programming language created by JetBrains. It runs on the Java Virtual Machine JVM , works alongside existing Java libraries, and is widely used for Android, backend, and multiplatform development. Static typing is especially useful when building agents. Agent configuration, tool schemas, and tool results can all be checked by the compiler before a prompt reaches the model. This sample uses Java 25 . If Java is not installed, SDKMAN https://sdkman.io/ is a convenient way to install and switch between JDK versions on Linux and macOS: After installing SDKMAN , list the available Java 25 distributions: sdk list java Install the Java 25 distribution you prefer, then verify the active version: java --version The project includes the Gradle wrapper, so you do not need to install Gradle separately. The Agent Development Kit ADK is Google's code-first framework for building and deploying AI agents. It provides the pieces needed to configure models, write agent instructions, connect tools, manage sessions, and run agents locally. Google provides the Kotlin quickstart and API documentation here: The complete Kotlin ADK source is also available on GitHub: Agent Development Kit ADK is designed for developers seeking fine-grained control and flexibility when building advanced AI agents that are tightly integrated with services in Google Cloud. It allows you to define agent behavior, orchestration, and tool use directly in code, enabling robust debugging, versioning, and deployment anywhere – from your laptop to the cloud. Rich Tool Ecosystem : Utilize pre-built tools, custom functions, OpenAPI specs, or integrate existing tools to give agents diverse capabilities, all for tight integration with the Google ecosystem. Code-First Development : Define agent logic, tools, and orchestration directly in Kotlin for ultimate flexibility, testability, and versioning. Modular Multi-Agent Systems : Design scalable applications by composing multiple specialized… The Kotlin SDK is published as com.google.adk:google-adk-kotlin-core . This tutorial uses Kotlin ADK 0.6.0 . You need a Gemini Developer API key to run the interactive agent. Create one in Google AI Studio: The MCP server and tool-discovery smoke test do not need an API key. Clone the sample repository and run the initialization script. It builds the project and creates a local .env file from the included template: git clone https://github.com/xbill9/adk-hello-world-kotlin cd adk-hello-world-kotlin source init.sh Output: Created .env from .env.example. Add your credentials before running the agent. Setup complete. Start ./server.sh, then run ./run.sh in another terminal. Edit .env and set your API key: GOOGLE API KEY=your-api-key Load it into the current shell: source set env.sh Note:Never commit .env . It is already listed in .gitignore . The sample has two Gradle modules: agent contains the Kotlin ADK agent and interactive command-line runner. server contains a Ktor MCP server that exposes the greet tool.The core agent is defined in GreetingAgent.kt . It configures Gemini, gives the agent its instruction, and connects an MCP toolset: return LlmAgent name = "kotlin greeting agent", description = "A Kotlin ADK agent that greets people through an MCP tool.", model = Gemini name = modelName, apiKey = apiKey, , instruction = Instruction """ You are a concise greeting assistant. When the user asks you to greet someone, always call the greet tool with that person's name. Return the greeting produced by the tool. """.trimIndent , , toolsets = listOf mcpToolset , LlmAgent brings together the model, instructions, and available tools. The model defaults to gemini-3.1-flash-lite , but you can select another model with the GEMINI MODEL environment variable. Unlike the TypeScript weather sample, this project keeps the tool in a separate process. The agent discovers and invokes it through the Model Context Protocol https://modelcontextprotocol.io/ . GreetingAgent.kt creates an McpToolset connected to the local server: val mcpToolset = McpToolset.McpToolsetConfig sseConnectionParams = McpConnectionParameters.Sse url = mcpServerUrl, sseEndpoint = "sse", , toolFilter = listOf "greet" , .toToolset The connection is lazy. When the agent needs its tools, ADK opens an MCP session, requests the tool list, and makes the greet schema available to Gemini. The tool filter limits this agent to that single tool. The server registers the tool in Tools.kt : server.addTool name = Config.Tools.GREET, description = "Get a greeting from a local HTTP server.", inputSchema = ToolSchema properties = buildJsonObject { put Config.Tools.GREET PARAM, buildJsonObject { put "type", "string" put "description", "The name to greet" }, }, required = listOf Config.Tools.GREET PARAM , , { request - // Read the name and return: Hello,