https://github.com/jetbrains/koog
Koog is a Kotlin-based framework designed to build and run AI agents entirely in idiomatic Kotlin.
https://github.com/jetbrains/koog
Last synced: 4 months ago
JSON representation
Koog is a Kotlin-based framework designed to build and run AI agents entirely in idiomatic Kotlin.
- Host: GitHub
- URL: https://github.com/jetbrains/koog
- Owner: JetBrains
- License: apache-2.0
- Created: 2025-05-01T13:38:01.000Z (5 months ago)
- Default Branch: develop
- Last Pushed: 2025-06-11T21:38:43.000Z (4 months ago)
- Last Synced: 2025-06-11T22:41:36.288Z (4 months ago)
- Language: Kotlin
- Homepage: https://docs.koog.ai
- Size: 2.68 MB
- Stars: 877
- Watchers: 176
- Forks: 52
- Open Issues: 48
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-ChatGPT-repositories - koog - Koog is the official Kotlin framework for building and running robust, scalable and production-ready AI agents across all platforms – from backend services to Android, JVM, and even in-browser environments. Koog is based on our AI products expertise and provides proven solutions for complex LLM and AI problems (Browser-extensions)
README
# Koog
[](https://kotlinlang.org/docs/components-stability.html)
[](https://search.maven.org/artifact/ai.koog/koog-agents)
[](https://github.com/JetBrains#jetbrains-on-github)
[](http://kotlinlang.org)
[](https://github.com/JetBrains/koog/actions?query=branch%3Amain)
[](LICENSE.txt)
[](https://docs.koog.ai)
[](https://kotlinlang.slack.com/messages/koog-agentic-framework/)## Overview
Koog is a Kotlin-based framework designed to build and run AI agents entirely in idiomatic Kotlin. It lets you create agents that can interact with tools, handle complex workflows, and communicate with users.
### Key features
Key features of Koog include:
- **Pure Kotlin implementation**: Build AI agents entirely in natural and idiomatic Kotlin.
- **MCP integration**: Connect to Model Context Protocol for enhanced model management.
- **Embedding capabilities**: Use vector embeddings for semantic search and knowledge retrieval.
- **Custom tool creation**: Extend your agents with tools that access external systems and APIs.
- **Ready-to-use components**: Speed up development with pre-built solutions for common AI engineering challenges.
- **Intelligent history compression**: Optimize token usage while maintaining conversation context using various pre-built strategies.
- **Powerful Streaming API**: Process responses in real-time with streaming support and parallel tool calls.
- **Persistent agent memory**: Enable knowledge retention across sessions and even different agents.
- **Comprehensive tracing**: Debug and monitor agent execution with detailed and configurable tracing.
- **Flexible graph workflows**: Design complex agent behaviors using intuitive graph-based workflows.
- **Modular feature system**: Customize agent capabilities through a composable architecture.
- **Scalable architecture**: Handle workloads from simple chatbots to enterprise applications.
- **Multiplatform**: Run agents on both JVM and JS targets with Kotlin Multiplatform.### Available LLM providers and platforms
The LLM providers and platforms whose LLMs you can use to power your agent capabilities:
- OpenAI
- Anthropic
- OpenRouter
- Ollama### Quickstart example
To help you get started with AI agents, here is a quick example:
```kotlin
fun main() = runBlocking {
// Before you run the example, assign a corresponding API key as an environment variable.
val apiKey = System.getenv("OPENAI_API_KEY") // or Anthropic, Google, OpenRouter, etc.val agent = AIAgent(
executor = simpleOpenAIExecutor(apiKey), // or Anthropic, Google, OpenRouter, etc.
systemPrompt = "You are a helpful assistant. Answer user questions concisely.",
llmModel = OpenAIModels.Chat.GPT4o
)val result = agent.runAndGetResult("Hello! How can you help me?")
println(result)
}
```## Using in your projects
### Supported targets
Currently, the framework supports the JVM and JS targets.
On JVM, JDK 17 or higher is required to use the framework.
### Gradle (Kotlin DSL)
1. Add dependencies to the `build.gradle.kts` file:
```
dependencies {
implementation("ai.koog:koog-agents:0.2.1")
}
```
2. Make sure that you have `mavenCentral()` in the list of repositories.
### Gradle (Groovy)1. Add dependencies to the `build.gradle` file:
```
dependencies {
implementation 'ai.koog:koog-agents:0.2.1'
}
```
2. Make sure that you have `mavenCentral()` in the list of repositories.
### Maven1. Add dependencies to the `pom.xml` file:
```
ai.koog
koog-agents
0.2.1
```
2. Make sure that you have `mavenCentral` in the list of repositories.
## Contributing
Read the [Contributing Guidelines](CONTRIBUTING.md).## Code of Conduct
This project and the corresponding community are governed by the [JetBrains Open Source and Community Code of Conduct](https://github.com/jetbrains#code-of-conduct). Please make sure you read it.## License
Koog is licensed under the [Apache 2.0 License](LICENSE.txt).## Support
Please feel free to ask any questions in our official Slack channel ([link](https://kotlinlang.slack.com/messages/koog-agentic-framework/))