Building an Agentic AI Mobile Tester with Koog and Kotlin

Testing Android apps is often repetitive, time-consuming, and hard to scale. Recently, I started experimenting with agentic AI to automate mobile testing—combining Kotlin, Koog, and LLMs to build a smart tester that can execute real end-to-end scenarios.

The result is my new project: Koog - Agentic Mobile Tester.


Why I Built This

As an Android developer, I’ve used Espresso, UIAutomator, and other frameworks. They’re powerful, but still rigid: you need to write detailed test scripts and keep them updated. I wanted to explore whether an AI agent could take high-level goals like “Log in and navigate to the profile screen” and figure out the steps automatically.


How It Works

The project is powered by Koog.ai and Kotlin, using an LLM as the reasoning engine (options include Gemini, Llama, GPT, or Gwen). Here’s the flow:

Ktor API & Koog Agent (Backend)

The backend is built with Ktor in Kotlin and powered by a custom Koog agent (MobileTestAgent) plus a toolkit of device actions (MobileTestTools).

Ktor API The Ktor server exposes endpoints that receive test scenarios and configuration (LLM model, temperature, iterations). Each request is routed to the MobileTestAgent, which runs the scenario with the chosen parameters.

MobileTestAgent (Koog Agent) MobileTestAgent encapsulates the Koog agent setup. It translates high-level test goals into an iterative reasoning process, where the LLM plans actions like “tap login button” or “enter text”. The agent respects limits such as max iterations and temperature to balance creativity and determinism.

MobileTestTools (Device Interaction) MobileTestTools provides the executable layer via ADB commands. It includes functions for:

These functions are registered as tools within Koog, so when the agent plans an action, Koog calls the corresponding method directly.

Execution Flow

At the end, a structured report is generated with actions, results, and optional artifacts (like screenshots), and returned to the frontend dashboard.

User Input (Frontend Dashboard)

Sample Android App


Example Flow

No need to maintain test scripts—just provide the goal.

AI Agentic Mobile Tester


Why Kotlin + Koog?

Kotlin gave me the flexibility to build a clean API with Ktor and manage complex agent logic easily. Koog.ai, with its Model Context Protocol (MCP) integration and agentic design, allowed me to connect the LLM with Android tooling like ADB seamlessly.

This mix of Kotlin, LLMs, and Android dev tools opens a new way of thinking about mobile testing: instead of scripting, you describe intentions.


What’s Next



This was a fun experiment mixing Kotlin + AI agents + Android testing. If you’re curious about agentic AI, Koog, or just want to rethink mobile testing, I’d love feedback, feel free to DM on LinkedIn! 🚀