Examples
The Koog framework provides examples to help you understand how to implement AI agents for different use cases. These examples demonstrate key features and patterns that you can adapt for your own applications.
Browse the examples below and click on the links to view the source code on GitHub.
Example | Description |
---|---|
Attachments | Learn how to use structured Markdown and attachments in prompts. Build prompts that include images and generate creative content for Instagram posts using OpenAI models. |
Banking | Build a comprehensive AI banking assistant with routing capabilities that can handle money transfers and transaction analysis through a sophisticated graph-based strategy. Includes domain modeling, tool creation, and agent composition patterns. |
BedrockAgent | Create intelligent AI agents using the Koog framework with AWS Bedrock integration. Learn how to define custom tools, set up AWS Bedrock, and build interactive agents that understand natural language commands for controlling devices. |
Calculator | Build a calculator agent that performs arithmetic operations using tools for addition, subtraction, multiplication, and division. Demonstrates parallel tool calls, event logging, and multiple executor support (OpenAI and Ollama). |
Chess | Build an intelligent chess-playing agent featuring complex domain modeling, custom tools, memory optimization techniques, and interactive choice selection. Demonstrates advanced agent strategies, game state management, and human-AI collaboration patterns. |
GoogleMapsMcp | Connect Koog to a Google Maps MCP server via Docker. Discover tools, geocode addresses, and fetch elevation data using AI agents with real-world geographic APIs in a Kotlin Notebook environment. |
Guesser | Build a number-guessing agent that implements a binary search strategy using tools to ask targeted questions. The agent efficiently narrows down the user's number through strategic questioning and demonstrates tool-based interaction patterns. |
Langfuse | Learn how to export Koog agent traces to Langfuse using OpenTelemetry. Set up environment variables, run agents, and inspect spans and traces in your Langfuse instance for comprehensive observability. |
MCP | Integration examples for the Model Context Protocol, featuring GoogleMapsMcpClient for geographic data and PlaywrightMcpClient for browser automation. |
Memory | A customer support agent that demonstrates memory system usage. The agent tracks user conversation preferences, device diagnostics, and organization-specific information using encrypted local storage and proper memory organization with subjects and scopes. |
OpenTelemetry | Add OpenTelemetry-based tracing to Koog AI agents. Learn to emit spans to console for debugging and export traces to OpenTelemetry Collector for viewing in Jaeger. Includes Docker setup and troubleshooting guide. |
Planner | A task planning system that builds execution trees with parallel and sequential execution nodes, dynamically constructing execution plans for complex workflows. |
PlaywrightMcp | Drive browsers with Playwright MCP and Koog. Launch a Playwright MCP server, connect via SSE, and let AI agents automate web tasks like navigation, cookie acceptance, and UI interaction through natural language commands. |
SimpleAPI | Basic examples demonstrating chat agents and single-run agents with simple API patterns for getting started with Koog. |
StructuredData | Demonstrates JSON-based structured data output with complex nested classes, polymorphism, and weather forecast examples showing how to work with typed data in agent responses. |
SubgraphWithTask | Project generation tools showcasing file and directory operations, including creation, deletion, and command execution using subgraph strategies. |
Tone | A text tone analysis agent that uses specialized tools to identify positive, negative, or neutral tones in input text, demonstrating sentiment analysis capabilities. |
UnityMcp | Drive Unity game development with AI agents using Unity MCP server integration. Connect to Unity via stdio, discover available tools, and let agents modify scenes, place objects, and execute game development tasks through natural language commands. |
VaccumAgent | Implementation of a basic reflex agent using the Koog framework. Covers environment modeling, tool creation, and agent behavior for automated cleaning tasks in a simple two-cell world. |
Weave | Learn how to trace Koog agents to W&B Weave using OpenTelemetry (OTLP). Set up environment variables, run agents, and view rich traces in the Weave UI for comprehensive monitoring and debugging. |