█

AI/TLDR

Buy me a coffee
Buy me a coffee

Koog

JetBrains' framework for building AI agents in idiomatic Kotlin and Java, from backend services to Android and iOS

Agent Frameworks & BuildersOpen source
Latest
1.3.0
Updated
24 Sep 2026
Language
Kotlin
License
Apache-2.0

What's new

1.3.024 Sep 2026

Adds ready-made model definitions with capabilities, context windows and pricing for new Anthropic, OpenAI, Google, Bedrock, DashScope, DeepSeek, Mistral, Ollama and OpenRouter models, and fixes Google prompt-cache token counts and empty assistant content in Langfuse traces.

IN SHORT

What is Koog?

Koog is an open-source framework from JetBrains for building and running AI agents entirely in Kotlin or Java. It sits in the Agent Frameworks & Builders category of the Agents & Automation tools and is open-source, written in Kotlin and licensed Apache-2.0. To get started: add the dependency.

Updated Markdown version ↗

Overview

Koog is an open-source framework from JetBrains for building and running AI agents entirely in Kotlin or Java. Instead of wrapping a Python stack, it gives JVM teams a type-safe Kotlin DSL and fluent Java builder APIs for agents that call tools, run multi-step workflows and talk to users. JetBrains open-sourced it in May 2025, shipped the first stable 1.0 release on May 21, 2026, and publishes it on Maven Central under the Apache 2.0 license.

Flow chart of Koog's basic strategy: send the input to the LLM; if it answers with a message, finish; otherwise run the tool it calls, send the result back and repeat
Koog's basic strategy graph: the agent loops through tool calls until the LLM answers with a message.Koog docs (custom strategy graphs) ↗

Every Koog agent runs a strategy: a directed graph of nodes such as "call the LLM", "execute a tool" and "send the tool result back". The simplest agents use a predefined strategy (a basic tool-calling loop, or ReAct, which alternates a reasoning step with an action step), while graph-based agents define their own nodes, edges, subgraphs and parallel branches. Koog also offers functional agents, where the logic is a plain lambda, and planner agents (beta) that build and execute a plan step by step.

Around that core sit the features long-running production agents need: built-in retries, agent persistence that restores state from a checkpoint, history compression to keep long conversations within the context window, switching to a different LLM mid-conversation without losing history, streaming, structured output, and RAG with embeddings. With Kotlin Multiplatform the same agent code targets the JVM, JS, WasmJS, Android and iOS, and integrations cover Spring Boot, Spring AI, Ktor, Amazon Bedrock AgentCore, the Model Context Protocol, A2A and the Agent Client Protocol.

What it does

  • Basic, functional, graph-based and planner (beta) agents, written in an idiomatic Kotlin DSL or with fluent Java builders
  • Strategy graphs with predefined strategies such as ReAct, custom nodes, subgraphs, parallel node execution and typed data transfer between nodes
Flow diagram of Koog's ReAct strategy: Start, CallLLMReason, CallLLMAction, then Finish if finished, or ExecuteTool and back to CallLLMReason if not
The predefined ReAct strategy alternates a reasoning call and an action call, running tools until the task is finished.Koog docs (predefined agent strategies) ↗
  • Tools as annotated functions (@Tool and @LLMDescription), class-based tools or built-in tools, plus MCP (beta), A2A (beta) and Agent Client Protocol integration
  • Reliability features: retries, agent persistence with checkpoints, history compression and switching LLM providers without losing the conversation
  • Clients for OpenAI, Anthropic, Google, DeepSeek, OpenRouter, Amazon Bedrock, Mistral and local Ollama models, with streaming and structured output
  • Tracing and OpenTelemetry exporters for Langfuse, W&B Weave and Datadog, and starters for Spring Boot, Spring AI and Ktor
A Koog agent run traced in Langfuse: the node tree with nodeCallLLM, nodeExecuteTool running HelloTool and ByeTool, and nodeSendToolResult, a graph of the strategy, and the prompt, tool results and final answer
A Koog agent run in Langfuse, traced node by node through the OpenTelemetry exporter, with the strategy graph and each tool call.Koog docs (Langfuse exporter) ↗

Getting started

Koog needs JDK 17 or newer on the JVM and Kotlin 2.3.10 or newer set explicitly in existing projects. The steps follow the project's README and the Quickstart in the Koog docs.

VideoKoog's technical lead walks through the framework's design on the Talking Kotlin podcast.Kotlin by JetBrains ↗

Add the dependency

Koog is on Maven Central. Add the core agents artifact (and, optionally, the beta additions module) to your Gradle build and make sure mavenCentral() is in your repositories. Maven users depend on koog-agents-jvm instead.

kotlinkotlin
dependencies {
    implementation("ai.koog:koog-agents:1.3.0")
    implementation("ai.koog:koog-agents-additions:1.3.0-beta")
}

Set a provider API key

Koog needs an API key from a supported provider or a local model running in Ollama. Keep the key in an environment variable rather than in source code.

bashbash
export OPENAI_API_KEY=your-api-key

Create and run your first agent

An AIAgent combines a prompt executor (the LLM client), a model and an optional system prompt. Calling run sends the input and returns the agent's answer.

kotlinkotlin
fun main() = runBlocking {
    val apiKey = System.getenv("OPENAI_API_KEY")
        ?: error("The API key is not set.")

    val agent = AIAgent(
        promptExecutor = MultiLLMPromptExecutor(OpenAILLMClient(apiKey)),
        llmModel = OpenAIModels.Chat.GPT4o
    )

    val result = agent.run("Hello! How can you help me?")
    println(result)
}

Give the agent a tool

Annotate functions in a class that implements ToolSet, describe them for the model with @LLMDescription, and register the set in the agent's ToolRegistry. The agent can then decide to call the tool while it works.

kotlinkotlin
@LLMDescription("Tools for getting weather information")
class MyFirstToolSet : ToolSet {
    @Tool
    @LLMDescription("Get the current weather for a location")
    fun getWeather(
        @LLMDescription("The city and state/country")
        location: String
    ): String {
        return "The weather in $location is sunny and 72°F"
    }
}

val agent = AIAgent(
    promptExecutor = simpleOpenAIExecutor(apiKey),
    systemPrompt = "Provide weather information for a given location.",
    llmModel = OpenAIModels.Chat.GPT4o,
    toolRegistry = ToolRegistry { tools(MyFirstToolSet()) }
)
agent.run("What's the weather like in New York?")

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Adding AI agents to an existing Spring Boot or Ktor backend without introducing a Python service
  • Shipping the same agent logic to Android, iOS and web clients through Kotlin Multiplatform
  • Building long-running, multi-step agents that must survive failures, resume from checkpoints and stay within the context window
  • Tracing and debugging agent runs node by node in Langfuse, W&B Weave or Datadog

Version history

Every verified update to Koog that AI/TLDR tracked, newest first — each links to our coverage and the official changeset.

  1. 2026-09-241.3.0

    Adds ready-made model definitions with capabilities, context windows and pricing for new Anthropic, OpenAI, Google, Bedrock, DashScope, DeepSeek, Mistral, Ollama and OpenRouter models, and fixes Google prompt-cache token counts and empty assistant content in Langfuse traces.

  2. 2026-05-211.0.0

    First stable release: modules split into stable and beta streams, deprecated APIs removed, graph DSL node names finalized, a redesigned Java interop layer, OpenTelemetry on Kotlin Multiplatform and Anthropic prompt caching.

How Koog compares

Koog alongside other open-source agent frameworks & builders tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
DeepSeek Harness★ 289kDeepSeek AI's open-source agent harness (dsh), built on Cordis, where models, tools, skills, sessions, sandboxes, storage and the UI are all plugins composed through profiles.
AutoGPT★ 188kOne of the earliest autonomous agent projects, now a platform for building and running agents from reusable blocks and workflows.
DeerFlow★ 86kByteDance's open-source super agent harness built on LangGraph: skills, sub-agents, sandboxes, a filesystem and long-term memory for long-horizon research, coding and content tasks.
nanobot★ 50.5kLightweight self-hosted personal AI agent framework in Python, with a WebUI, terminal and chat-app channels, tools, long-term memory, MCP and scheduled automations.
LangGraph★ 45.6kA library from the LangChain team for building stateful, graph-based agent workflows with explicit control over steps, memory, and human-in-the-loop checkpoints.
Agno★ 43.3kA fast Python framework (formerly Phidata) for building agents with memory, tools, and multimodal inputs, plus a runtime for deploying them in production.
AgentGPT★ 36.3kAgentGPT lets you name a custom AI, give it a goal, and watch it plan tasks, run them, and learn from the results, all from a web browser.
Koog★ 4.7kJetBrains' framework for building AI agents in idiomatic Kotlin and Java, from backend services to Android and iOS