Koog Documentation — JetBrains AI Agent Framework for Kotlin and Java
by JetBrains
Build production agents in idiomatic Kotlin or Java without bolting on a Python service.
Overview
Koog is JetBrains' open-source framework for building AI agents entirely in idiomatic Kotlin and Java, and its documentation is structured as a working reference for JVM engineers. The navigation opens with agent types — basic, functional, graph-based and planner — so you choose a control-flow model before writing code, then moves through core components: prompts, strategies, tools and features. Tools can be defined annotation-based, class-based or fully custom. An advanced usage section covers the concerns that separate a demo from a service: history compression to bound token cost across long conversations, agent persistence so runs survive restarts, structured and type-safe output, streaming APIs, knowledge retrieval with vector embeddings for RAG, and tracing. Integrations and protocols cover Model Context Protocol, the A2A protocol and the Agent Client Protocol, alongside Spring Boot, Ktor, Spring AI and Amazon Bedrock, with OpenTelemetry exporters for Datadog, Langfuse and Weave. Supported model providers include Google, OpenAI, Anthropic, DeepSeek, OpenRouter, Ollama and AWS Bedrock. Because it is Kotlin Multiplatform, the same agent code targets JVM, JavaScript, WasmJS, Android and iOS. The project is Apache 2.0 licensed at version 1.2.0 with roughly 4.5k stars and 466 forks, and is maintained by JetBrains rather than a single-vendor startup.
At a Glance
- Topic
- Frameworks
- Level
- Intermediate
- Format
- Documentation
- Cost
- Free
- Duration
- Reference docs — first agent running in ~20 minutes, ~3 hours for the core guides
- Provider
- JetBrains
- Hands-on
- Yes — code/exercises
- Certificate
- None
What You’ll Learn
- ✓Choose between basic, functional, graph-based and planner agent control flows
- ✓Build a graph-based agent strategy with explicit nodes, edges and branching
- ✓Define tools three ways: annotation-based, class-based or fully custom implementations
- ✓Compress conversation history to keep token cost bounded across long sessions
- ✓Persist and restore agent state so a run survives a process restart
- ✓Connect to MCP servers and speak A2A and Agent Client Protocol
- ✓Export agent traces to OpenTelemetry collectors such as Langfuse, Datadog or Weave
- ✓Embed an agent inside a Spring Boot or Ktor service idiomatically
- ✓Get type-safe structured output from an LLM without hand-parsing JSON
Highlights
- •The only mainstream production agent framework built and maintained by JetBrains for the JVM
- •Type-safe Kotlin and Java APIs — no Python sidecar to deploy and keep alive beside your service
- •Kotlin Multiplatform, so the same agent code targets JVM, JavaScript, WasmJS, Android and iOS
- •First-class MCP, A2A and Agent Client Protocol support rather than community-maintained adapters
- •Apache 2.0 at v1.2.0 with ~4.5k stars, shipping Spring Boot and Ktor integrations in-tree
Who It’s For
Best For
- ✓JVM teams asked to add agents without introducing a separate Python service
- ✓Android or Kotlin Multiplatform developers embedding an agent on-device
- ✓Spring Boot shops that need agent code inside existing observability and deployment pipelines
- ✓Java engineers who want type safety and compile-time checks around tool definitions
Prerequisites
- •Working Kotlin or Java with a Gradle or Maven build
- •Familiarity with LLM prompting and tool/function calling concepts
- •An API key for a supported provider, or a local Ollama installation
FAQ
What is Koog Documentation — JetBrains AI Agent Framework for Kotlin and Java?
Official documentation for Koog, JetBrains' open-source agent framework for the JVM. It covers four agent styles, tool definition, history compression, persistence, structured output, RAG, and MCP/A2A protocol support, plus Spring Boot and Ktor integration. Written for Kotlin and Java engineers who have been asked to add agents to an existing JVM service and do not want a second runtime to operate.
Is Koog Documentation — JetBrains AI Agent Framework for Kotlin and Java free?
Koog Documentation — JetBrains AI Agent Framework for Kotlin and Java is free to access.
What level is Koog Documentation — JetBrains AI Agent Framework for Kotlin and Java for?
Koog Documentation — JetBrains AI Agent Framework for Kotlin and Java is aimed at a intermediate audience. Recommended background: Working Kotlin or Java with a Gradle or Maven build, Familiarity with LLM prompting and tool/function calling concepts, An API key for a supported provider, or a local Ollama installation.
How long does Koog Documentation — JetBrains AI Agent Framework for Kotlin and Java take?
Expect roughly Reference docs — first agent running in ~20 minutes, ~3 hours for the core guides. Most learners work through it at their own pace.
What will I learn from Koog Documentation — JetBrains AI Agent Framework for Kotlin and Java?
You'll learn: Choose between basic, functional, graph-based and planner agent control flows; Build a graph-based agent strategy with explicit nodes, edges and branching; Define tools three ways: annotation-based, class-based or fully custom implementations; Compress conversation history to keep token cost bounded across long sessions; Persist and restore agent state so a run survives a process restart; Connect to MCP servers and speak A2A and Agent Client Protocol; Export agent traces to OpenTelemetry collectors such as Langfuse, Datadog or Weave; Embed an agent inside a Spring Boot or Ktor service idiomatically; Get type-safe structured output from an LLM without hand-parsing JSON.
Topics
Sources
This page was written from 2 sources, 1 on domains other than docs.koog.ai.