Vadim Briliantov
03/18/2026, 2:49 AMKoog for Java .
It's been a huge challenge for the whole team but now you can use the same framework seamlessly in both Kotlin and Java projects, with a truly native feel in each.
This makes Koog the first major Kotlin framework that was brought to Java K
Feel free to share this exciting news with your Java colleagues!
Curious how it works? Check out the details š
https://blog.jetbrains.com/ai/2026/03/koog-comes-to-java/?_cl=MTsxOzE7TGpyMlc2Sld2bHBxOEZHQm1iWEd0UkJTaUtmbDJhQXM3VVhJbnlvcVRLeXVTYkViVlBNS1d5cW9Jb2xpOEF5Wjs=Didier Villevalois
03/21/2026, 7:08 AMVadim Briliantov
03/21/2026, 10:37 AMVadim Briliantov
03/21/2026, 10:39 AMDidier Villevalois
03/21/2026, 10:45 AMjavaXXX() are visible in auto-completion. Is there a cost on the IDE when you are working on a constrained laptop? I though we could use expect/actuals and have a java-dedicated java Kotlin source-sets in addition to the jvmMain ones in order to produce dedicated koog-xxx-java artifacts.Vadim Briliantov
03/23/2026, 12:08 AMAndrey Bragin
03/23/2026, 11:06 AMKoog introduced a JSONObject and a TypeToken which make Tool integration particularly confusing and less Kotlin-idomatic (like KSerializer-based constructors being deprecated).This is not only related to Java since it allows us to support other serialization frameworks on Kotlin/JVM, as Vadim mentioned. E.g. we got multiple requests to support Jackson, since a lot of teams that do backend with Kotlin use Spring, and Jackson is the default serialization library there. And in general, Jackson is the most popular serialization library on the JVM afaik, so some Kotlin/JVM developers feel weird using another, unfamiliar to them kotlinx.serialization just for Koog. I do understand that it comes with trade-offs though, especially if you are on a pure Kotlin stack and only use kotlinx.serialization. When implementing this new serialization API, we tried making it as simple and familiar to the kotlinx.serialization as possible. Moreover, we provide helper converters between serialization libraryās own dynamic JSON objects (
JsonElement in kotlinx.serialization or JsonNode in Jackson) and our own JSONElement abstraction. The idea is that you donāt have to interact with Koogās JSONElement manually if you donāt want too, you can convert to/from dynamic JSON objects of your library of choice. Thatās what we do internally. You can think of JSONElement as an intermediate representation that is serializable with both serialization libraries and allows for serialization-library agnostic implementations were it matters (such as tool args/results).
And regarding TypeToken, can you elaborate, why is it confusing? The idea was, again, to make it as close to familiar concepts on the Kotlin side as possible. Itās similar to typeOf<Foo>() from stdlib that creates a KType instance. You can just replace Foo.serializer() with typeToken<Foo>() in tool constructors and it will work the same as before. It will search for the correct serializer in the Json.serializersModule in the AIAgentConfig.serializer you specified. And you donāt even have to specify this serializer manually, since itās KotlinxSerializer() by default anyway. As a bonus, you can now configure contextual serializers (if you donāt/canāt annotate target classes with @Serializable to leverage compiler plugin code generation, e.g. for third-party types) in one place, when setting AIAgentConfig.serializer . So you donāt have to keep concrete KSerializer instances at hand when constructing a new tool.
Here is the doc page describing this serialization API, JSONElement interface and supported libraries and converters.
https://docs.koog.ai/serialization/#how-features-use-the-serializer. Here are all the available converters for kotlinx.serialization: https://github.com/JetBrains/koog/blob/6e22a66bbc8f1fa39466982312219f3bb80943e3/se[ā¦]tlin/ai/koog/serialization/kotlinx/KotlinxJSONElementMappers.kt
So you can do something like this for interop (weāre doing the same thing internally)
val koogJson: JSONElement = ...
val kotlinxJson: JsonElement = koogJson.toKotlinxJsonElement()
// perform some transformations if needed
val updatedKoogJson: JSONElement = kotlinxJson.toKoogJSONElement()
Please let me know if it addresses some of your serialization-related concerns, at least partially, and if you have any suggestions how to make it betterMark Tkachenko
03/23/2026, 11:07 AMAs for the jar sizes ā I think we measured at some point and it wasn't a huge difference between 0.6.4 and 0.7.*publishing bundle for 0.6.4 was ~40MB, 0.7.1 was 45MB. Considering a bunch of new modules in 0.7.* it's expected increase.
Andrey Bragin
03/23/2026, 11:12 AMI though we could use expect/actuals and have a java-dedicatedWe already use expect/actual to provide JVM vs non-JVM APIs. The problem, as I understand it, is that you canāt just put Java code toKotlin source-sets in addition to thejavaones in order to produce dedicatedjvmMainartifacts.koog-xxx-java
java source set and make it invisible on Kotlin/JVM target. Java code would still be included in the JVM distribution.
As for creating completely separate modules, it would be significantly more complex implementation-wise. We would have to reimplement or copy-paste Koogās core entities (such as LLM session, agent session etc.), which is more error-prone and makes it way harder to maintain. TBH even the current way we implemented it, with expect/actual, already increased complexity and maintenance load a bit. The completion concern is however perfectly valid. Iām afraid thereās no clean way to completely hide Java API methods from Kotlin/JVM code, thatās just how Kotlin works. However, we can try to brainstorm, maybe we would be able to find some neat solutions to make a completion experience betterVadim Briliantov
03/23/2026, 1:10 PMConsidering a bunch of new modules in 0.7.*we added Spring AI integration, Chat Memory, Long-Term Memory ā all came with some dependencies of course. 5MB sounds reasonable for all of these. Additionally, you can still depend on individual smaller modules instad of the GOD-module ākoog-agentsā
Didier Villevalois
03/23/2026, 11:10 PMYou can think ofSo there is an intermediate tree materialized in memory, right? And so if I use an MCP tool, I will deserialize the data from the server with Kotlinx Serialization (via the SDK), Koog will transform the Json tree into a Koog json tree and then serialize it for the model. Am I right?as an intermediate representation [...]JSONElement
And regardingBecause, I wasn't understanding why a tool needed a type token (and a new one). I now understand it is to inform some kind of an equivalent of to serializers module in Koog. Plus we already have KClass and KType. And in my app, I have Kaveriit's TypeToken (Kodein)., can you elaborate, why is it confusing?TypeToken
Vadim Briliantov
03/24/2026, 1:50 AMDidier Villevalois
03/24/2026, 7:40 AMtypeOf<T>()... JB really needs to consolidate reflection on KMP. šAndrey Bragin
03/26/2026, 9:06 AMJB really needs to consolidate reflection on KMPWhile I partially agree here, there are certain cases when you have to implement your own type token-like type that suits your specific use cases. E.g., in Koog we also have to provide a Java-friendly way to provide type information, so we canāt use
KTypeVadim Briliantov
03/26/2026, 9:21 AM