Koog tutorial: typed AI agents in Java

Learn Koog's Java API through a banking assistant example, with typed workflows, Spring Boot integration, graph checkpoints and history compression.

Player not loading? Watch on YouTube

Vadim Briliantov introduces Koog's Java API in this JavaOne 2026 talk. The open source JVM framework connects application tools to models. The example uses OpenAI; the speaker also names Ollama as an option for local models, though this is not a local LLM setup walkthrough.

The tutorial builds a banking assistant with Java methods for account reads, transfers and user communication. It injects the authorized user's ID into the tool class rather than letting the model supply it. Spring Boot integration and chat memory follow, including a PostgreSQL history provider via JDBC and an example window of 50 messages.

The central lesson concerns control over tool execution. Briliantov replaces an unrestricted loop with typed subtasks that identify an issue, fix it and verify the result. Each step gets a limited tool set. Java records describe outputs, and graph edges require compatible types or explicit transformations. Failed verification routes the workflow through an adjustment step.

The talk also explains operational tradeoffs. Graph strategies support checkpoint recovery; functional strategies allow ordinary Java control flow but lose persistence and some observability. Later examples cover tracing and history compression. Briliantov cautions that a single summary can omit information the model needs, then describes chunking and fact retrieval as alternatives.