Available Examples
Each example demonstrates different aspects of the Koog framework, with complete source code and step-by-step explanations.Simple Agent Examples
Simple Agent Examples
A comprehensive collection of runnable examples demonstrating core Koog concepts:
- Calculator agents with tool calling
- Banking assistant with routing
- Structured output and streaming
- Memory and persistence patterns
- OpenTelemetry integration
Code Agent Tutorial
Building a Code Agent
A progressive, 5-step tutorial building a production-grade coding agent:
- Step 1: Minimal agent with file operations
- Step 2: Add shell command execution
- Step 3: Integrate observability (Langfuse)
- Step 4: Add specialized sub-agents
- Step 5: Implement history compression
Trip Planning Agent
Trip Planning Agent
An advanced agent that plans trips by integrating multiple APIs:
- Google Maps via MCP (Model Context Protocol)
- Weather forecasts from Open Meteo
- Interactive user conversations
- Complex graph-based strategy
ACP Agent Integration
ACP Agent for IDEs
Connect Koog agents to IntelliJ IDEA using the Agent Communication Protocol:
- File operations and code navigation
- IDE integration patterns
- Bidirectional communication
- Session management
Spring Boot Integration
Spring Boot Integration
Production-ready Spring Boot application with Koog agents:
- REST API for chat interactions
- MCP server integration (GitHub)
- S3 persistence for agent state
- Configurable via YAML
Quick Start
All examples are available in the Koog GitHub repository:Prerequisites
Before running the examples, ensure you have:- Java 17+ installed
- Kotlin 1.9+ (included with Gradle)
- API Keys for LLM providers:
- OpenAI API key (most examples)
- Anthropic API key (optional)
- Google AI API key (optional)
Setting Up API Keys
Set your API keys as environment variables:env.properties file in your project root:
Example Difficulty Levels
Beginner
Beginner
Examples with minimal complexity, perfect for learning basic Koog concepts:
- Simple calculator agents
- Basic tool calling
- Single-run strategies
Intermediate
Intermediate
Examples demonstrating more complex patterns:
- Multi-agent routing
- Event handling and observability
- Structured output
- State persistence
Advanced
Advanced
Production-ready implementations with advanced features:
- Complex graph strategies
- Multi-API integration
- MCP protocol integration
- History compression
- Sub-agent orchestration
Learning Path
We recommend exploring examples in this order:- Start with Simple Agent Examples to understand core concepts
- Follow the Code Agent Tutorial to build a complete agent step-by-step
- Explore Trip Planning for advanced multi-API integration
- Try Spring Boot Integration for production deployment
- Experiment with ACP Agent for IDE integration
Additional Resources
- Interactive Notebooks: Jupyter notebooks for hands-on learning in the
examples/notebooks/directory - API Reference: Detailed API documentation at api.koog.ai
- Community: Join discussions on GitHub
Next Steps
Simple Agent Examples
Start with basic examples
Code Agent Tutorial
Build a coding agent step-by-step