This repository contains examples and utilities for working with the Koog AI agent framework.
Koog Playground is a project that demonstrates various capabilities of the Koog framework for building AI agents. It includes examples of:
- AI agents implementation
- Strategy patterns for AI interactions
- API integrations
- Tool sets for extending agent capabilities
- Utility functions
src/main/kotlin/Main.kt- Main application entry pointsrc/main/kotlin/QuickstartExample.kt- Quick start example for the Koog frameworksrc/main/kotlin/me/bossm0n5t3r/LoggerExtension.kt- Logger utility extensions
src/main/kotlin/me/bossm0n5t3r/agent/- AI agent implementationsAIAgentSample.kt- Sample AI agent implementation
src/main/kotlin/me/bossm0n5t3r/api/- API integration examplesPromptApi.kt- Prompt API integrationSingleApi.kt- Single API call examples
src/main/kotlin/me/bossm0n5t3r/di/- Dependency injection configurationAppModule.kt- Koin dependency injection module
src/main/kotlin/me/bossm0n5t3r/mcp/- Model Context Protocol implementationsGoogleMaps.kt- Google Maps integration for location-based queriesPlaywright.kt- Playwright for browser automation tasks
src/main/kotlin/me/bossm0n5t3r/opentelemetry/- OpenTelemetry and observabilitylangfuse/- Langfuse tracing integrationAgentWithLangfuseTracing.kt- Agent with Langfuse tracing capabilitiesdocker-compose.yml- Docker setup for Langfuse
src/main/kotlin/me/bossm0n5t3r/strategies/- Strategy patterns for AI interactionsCustomStrategyGraphs.kt- Custom strategy graph implementationsHistoryCompression.kt- History compression strategiesPredefinedStrategiesAndCommonStrategyPatterns.kt- Common strategy patternsStructuredDataProcessing.kt- Structured data processing strategies
src/main/kotlin/me/bossm0n5t3r/tools/- Tool sets for extending agent capabilitiesAgentWithWeatherToolSet.kt- Agent with weather tool integrationDiagnosticToolSet.kt- Diagnostic tools for debuggingMyToolSet.kt- Custom tool set implementationWeatherToolSet.kt- Weather-related tools
src/main/kotlin/me/bossm0n5t3r/utils/- Utility functionsHelper.kt- Helper utilities
src/test/kotlin/me/bossm0n5t3r/api/- API testsPromptApiTest.kt- Tests for Prompt API
- JDK 21 or higher
- Gradle
- Clone the repository
- Build the project:
./gradlew build - Run examples:
./gradlew run
Check out QuickstartExample.kt for a simple demonstration of how to use the Koog framework.
The application provides an interactive menu to run different examples:
-
Run the application:
./gradlew run -
Select an example to run from the menu by entering the corresponding number:
> Task :run 00:00:00.249 [main] INFO Application -- Hello, Kotlin! 00:00:00.311 [main] INFO Application -- Please select the example to run: 00:00:00.314 [main] INFO Application -- 1. PromptApi 00:00:00.314 [main] INFO Application -- 2. SingleApi 00:00:00.314 [main] INFO Application -- 3. AIAgent 00:00:00.314 [main] INFO Application -- 4. AgentWithWeatherToolSet 00:00:00.314 [main] INFO Application -- 5. StructuredDataProcessing 00:00:00.314 [main] INFO Application -- 6. Google Maps 00:00:00.314 [main] INFO Application -- 7. Playwright 00:00:00.314 [main] INFO Application -- 0. Exit Enter your choice: <==========---> 83%00:00:00.773 [main] INFO Application -- -
Follow the prompts for the selected example.
Each example demonstrates different capabilities of the Koog framework:
- PromptApi: Shows how to use the prompt API for generating responses
- SingleApi: Demonstrates single API calls to LLM models
- AIAgent: Basic AI agent implementation
- AgentWithWeatherToolSet: AI agent with weather-related tools
- StructuredDataProcessing: Processing structured data with AI
- Google Maps: Using Google Maps MCP for location-based queries
- Playwright: Browser automation using Playwright MCP
This project uses:
- Koog Agents library
- Koin for dependency injection
- KotlinX Serialization for JSON handling
- JUnit 5 and MockK for testing