Skip to main content

Requirements

Before installing Koog, ensure your environment meets these requirements:

JDK 17+

JDK 17 or higher is required for JVM targets

Kotlin 2.2+

Koog is built with Kotlin 2.3.10

Coroutines 1.10.2

kotlinx-coroutines 1.10.2 must be set explicitly

Serialization 1.8.1+

kotlinx-serialization 1.10.0 is recommended
Important: If you have an existing Kotlin project, you must explicitly set kotlinx-coroutines version to 1.10.2 and kotlinx-serialization to 1.10.0 or higher to avoid compatibility issues.

Supported Platforms

Koog supports the following Kotlin Multiplatform targets:
  • JVM: Full support for Java 17+
  • JavaScript: Browser and Node.js
  • WasmJS: WebAssembly for browsers
  • iOS: Native iOS applications
  • Android: Android applications (via JVM)

Installation Methods

Step 1: Add Dependencies

Add Koog to your build.gradle.kts file:
build.gradle.kts
dependencies {
    implementation("ai.koog:koog-agents:0.7.0")
}

Step 2: Configure Repositories

Ensure you have Maven Central in your repositories:
build.gradle.kts
repositories {
    mavenCentral()
}

Step 3: Set Kotlin Versions

Explicitly configure the required kotlinx library versions:
build.gradle.kts
dependencies {
    implementation("ai.koog:koog-agents:0.7.0")
    
    // Required versions
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2")
    implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.10.0")
}

Complete Example

Here’s a complete build.gradle.kts for a JVM project:
build.gradle.kts
plugins {
    kotlin("jvm") version "2.3.10"
    kotlin("plugin.serialization") version "2.3.10"
    application
}

group = "com.example"
version = "1.0-SNAPSHOT"

repositories {
    mavenCentral()
}

dependencies {
    // Koog framework
    implementation("ai.koog:koog-agents:0.7.0")
    
    // Required kotlinx libraries
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2")
    implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.10.0")
    
    // Logging (optional but recommended)
    implementation("io.github.oshai:kotlin-logging:7.0.7")
    implementation("ch.qos.logback:logback-classic:1.5.13")
}

kotlin {
    jvmToolchain(17)
}

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

Additional Modules

Koog provides additional modules for specific functionality:

Spring Boot Integration

For Spring Boot applications:
implementation("ai.koog:koog-spring-boot-starter:0.7.0")

Ktor Integration

For Ktor server applications:
implementation("ai.koog:koog-ktor:0.7.0")

Feature Modules

Install specific features as needed:
// Memory and chat history
implementation("ai.koog:agents-features-memory:0.7.0")

// SQL-based persistence
implementation("ai.koog:agents-features-sql:0.7.0")

// OpenTelemetry observability
implementation("ai.koog:agents-features-opentelemetry:0.7.0")

// Model Context Protocol (MCP)
implementation("ai.koog:agents-mcp:0.7.0")

// Agent Client Protocol (ACP)
implementation("ai.koog:agents-features-acp:0.7.0")

Verify Installation

Create a simple test file to verify your installation:
Main.kt
import ai.koog.agents.core.agent.AIAgent
import ai.koog.prompt.executor.llms.all.simpleOpenAIExecutor
import ai.koog.prompt.executor.clients.openai.OpenAIModels

suspend fun main() {
    val apiKey = System.getenv("OPENAI_API_KEY")
        ?: error("Set OPENAI_API_KEY environment variable")
    
    simpleOpenAIExecutor(apiKey).use { executor ->
        val agent = AIAgent(
            promptExecutor = executor,
            systemPrompt = "You are a helpful assistant.",
            llmModel = OpenAIModels.Chat.GPT4oMini
        )
        
        val result = agent.run("Say hello!")
        println(result)
    }
}
Run the file:
export OPENAI_API_KEY="your-api-key-here"
./gradlew run
If everything is set up correctly, you should see a response from the AI agent!

Troubleshooting

If you see errors like kotlin.coroutines.jvm.internal.BaseContinuationImpl, ensure you’re using kotlinx-coroutines version 1.10.2:
dependencies {
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2")
}
For Maven:
<dependency>
    <groupId>org.jetbrains.kotlinx</groupId>
    <artifactId>kotlinx-coroutines-core-jvm</artifactId>
    <version>1.10.2</version>
</dependency>
Make sure you have the Kotlin serialization plugin enabled:Gradle:
plugins {
    kotlin("plugin.serialization") version "2.3.10"
}
Maven:
<compilerPlugins>
    <plugin>kotlinx-serialization</plugin>
</compilerPlugins>
Koog requires JDK 17+. Configure your Kotlin JVM target:Gradle:
kotlin {
    jvmToolchain(17)
}
Maven:
<configuration>
    <jvmTarget>17</jvmTarget>
</configuration>
If you can’t find Koog modules, verify that Maven Central is in your repositories:Gradle:
repositories {
    mavenCentral()
}
Maven:
<repositories>
    <repository>
        <id>central</id>
        <url>https://repo.maven.apache.org/maven2</url>
    </repository>
</repositories>

Next Steps

Now that Koog is installed, you’re ready to build your first agent:

Quickstart Tutorial

Build a complete working agent in 5 minutes

Core Concepts

Learn about agents, tools, and strategies

LLM Providers

Configure OpenAI, Anthropic, Google, and more

Examples

Explore real-world examples and patterns

Build docs developers (and LLMs) love