What is Koog?
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 across multiple platforms. Built by JetBrains, Koog brings type-safety, coroutines, and the full power of Kotlin to AI agent development.Koog is currently in Alpha stage. The API is stabilizing but may still undergo changes.
Why Choose Koog?
Koog stands out from other agent frameworks by leveraging Kotlin’s strengths:Type-Safe DSL
Build agents with an idiomatic Kotlin DSL that catches errors at compile-time, not runtime.
Multiplatform Ready
Deploy the same agent code to JVM, JavaScript, WasmJS, Android, and iOS.
Production-Grade
Built-in fault tolerance, state persistence, and enterprise integrations for Spring Boot and Ktor.
Developer-Friendly
Leverage coroutines for async operations and enjoy full IDE support with IntelliJ IDEA.
Key Features
Graph-Based Workflows
Define agent behavior as a state machine with nodes and edges. This makes complex multi-step workflows explicit and debuggable:Reliability & Fault Tolerance
- Automatic Retries: Built-in retry logic for LLM API calls and tool executions
- State Persistence: Save and restore agent state at specific execution points
- Checkpointing: Resume long-running tasks after failures
- Error Handling: Comprehensive error reporting with detailed tracing
Intelligent History Management
Optimize token usage while maintaining context:- Automatic Compression: Compress conversation history when token limits are approached
- Configurable Strategies: Choose between summarization, windowing, or custom compression
- Context Preservation: Keep important messages while reducing token count
LLM Provider Flexibility
Switch between providers seamlessly without losing conversation context:OpenAI
GPT-4, GPT-4o, GPT-3.5
Anthropic
Claude 3 and Claude 4 models
Gemini 1.5 Pro and Flash
Ollama
Local open-source models
DeepSeek
DeepSeek models
Others
OpenRouter, Bedrock, Mistral
Enterprise Integration
- Spring Boot Starter: Drop-in integration for Spring Boot applications
- Ktor Support: Native support for Ktor server applications
- OpenTelemetry: Built-in observability with W&B Weave, Langfuse, and custom exporters
- Database Persistence: SQL-based persistence with Exposed ORM
Advanced Capabilities
Model Context Protocol (MCP)
Model Context Protocol (MCP)
Integrate with MCP servers to access external tools and data sources. Use tools from the MCP ecosystem directly in your agents.
Agent Client Protocol (ACP)
Agent Client Protocol (ACP)
Build ACP-compliant agents that can communicate with standardized client applications and other agents.
Vector Embeddings & RAG
Vector Embeddings & RAG
Add long-term memory to agents using vector storage and retrieval-augmented generation (RAG) patterns.
Streaming Responses
Streaming Responses
Process LLM responses in real-time with streaming support, including parallel tool call execution.
Custom Tools
Custom Tools
Create type-safe tools using Kotlin annotations. Tools integrate seamlessly with the agent execution environment.
Comprehensive Testing
Comprehensive Testing
Mock LLM responses and tool behaviors with the built-in testing framework. Test graph structures without making API calls.
Architecture Overview
Koog is built on a modular architecture with clear separation of concerns:Core Components
- AIAgent: The main orchestrator that manages the agent lifecycle
- PromptExecutor: Handles communication with LLM providers
- Strategy: Defines the agent’s behavior as a graph of nodes and edges
- ToolRegistry: Manages available tools and their execution
- Features: Modular capabilities like memory, tracing, and persistence
Use Cases
Koog is ideal for:- Task Automation: Agents that execute multi-step workflows with tool calls
- Customer Support: Conversational agents with access to knowledge bases
- Code Analysis: Agents that read, analyze, and modify code
- Data Processing: Agents that extract, transform, and analyze data
- Research Assistants: Agents that search, summarize, and synthesize information
- API Integration: Agents that interact with external services and APIs
Getting Started
Ready to build your first agent? Follow these guides:Quickstart
Build your first agent in 5 minutes
Installation
Add Koog to your Kotlin project
Core Concepts
Understand the fundamentals
Examples
Explore real-world examples
Community
Join the Koog community:- Slack: Join our Slack channel for discussions and support
- GitHub: Star and contribute on GitHub
- Issue Tracker: Report bugs on YouTrack
Next Steps
Install Koog
Follow the installation guide to add Koog to your project
Build Your First Agent
Complete the quickstart tutorial to create a working agent
Learn Core Concepts
Read about agents, tools, and strategies
Explore Examples
Browse the examples to see patterns and best practices