JetBrains Open-Sources KotlinLLM, a Research Prototype for Runtime Code Generation

JetBrains has released KotlinLLM as open source, giving Kotlin/JVM developers a research prototype that lets applications generate their own logic at runtime — and then keep it as ordinary, reviewable source code.

The tool comes from JetBrains Research, built by Anastasia Birillo and Stanislav Sandler, and it tackles a problem most teams have only half-solved so far: how do you let an LLM handle logic that’s too messy or too variable to hand-write, without turning your production app into something that depends on a live model call every time it runs?

KotlinLLM is an IntelliJ IDEA plugin that adds what the team calls “Smart macros” — Kotlin function calls whose bodies are generated code. There are two of them in the public API right now. asLlm<F, T>() takes unstructured or semi-structured input and converts it into a typed Kotlin value — a data class, an enum, a list, a primitive. mockLlm<T>() generates a stateful implementation of an interface, so it behaves like a test double you didn’t have to write by hand.

The call site looks like ordinary Kotlin. What’s different is what happens underneath. Instead of shipping out to a model every time the function runs, KotlinLLM generates real Kotlin source the first time it hits a new scenario, then reuses that code going forward. No further model call, no added latency, and reproducible output because it’s compiled code sitting in your repo.

“A model call in the request path has no SLA,” said Mitch Ashley, VP and practice lead for software lifecycle engineering and AI-native software engineering at The Futurum Group. “Generating the code once and committing it puts that logic back under change control. Teams get a diff, a test, and a rollback path instead of a prompt they have to trust.”

That distinction matters because most existing approaches to this problem have real tradeoffs. Calling an LLM directly on every request is slow and non-deterministic, and it makes your app dependent on an external service at runtime. Routing logic through an external agent workflow keeps that logic outside your codebase, where it’s harder to review or test. And most of the prior research in this space — projects like byLLM, nightjar, and Healer — was built for interpreted languages like Python. Kotlin, compiled and statically typed, hadn’t really been addressed the same way.

JetBrains designed KotlinLLM around three properties: it’s explicit, so a reviewer can see a feature is LLM-backed just by reading the call site; it’s persistent, since generated behavior gets saved as source rather than living only in a runtime session; and it’s portable, meaning the generated code runs as plain Kotlin once the plugin isn’t in the loop anymore.

Ashley pointed to that first property as the real payoff for teams already stretched thin on review capacity. “Self-evidencing code is how teams pay down verification debt,” he said. “A reviewer can see the call site is model-backed and read exactly what it produced. Anyone shipping AI-generated logic into production owes reviewers that much.”

The team tested the approach on two projects. An adapted version of Spring Petclinic Kotlin used 18 asLlm call sites and completed all 24 application scenarios after the Smart macros evolved, with a 100% hot-reload success rate. Compilation and redefinition added roughly 1% runtime overhead — a small enough tax to make the approach realistic for actual use. A second test, a synthetic tool called GitHub Beginner Issue Radar, parsed real issue data across 20 repositories — more than 30,000 issues — and reached about 0.89 recall against ground-truth beginner labels.

This isn’t the first attempt at bringing LLMs into runtime logic. Research out of the University of Michigan on byLLM took a similar swing at the problem for Python, using a compiler that reads semantic intent from code and turns it into targeted prompts. That project has already seen over 14,000 downloads in a single month since going open source, which says something about how much appetite there is for this kind of tooling — developers want AI-generated logic they can actually own, not just call.

The KotlinLLM repository is public now under the Apache License 2.0. It includes the IntelliJ plugin, the Smart macro API, and runnable example projects—including the committed generated source from both test cases —so anyone can see exactly what the LLM produced and run it as regular Kotlin. JetBrains also published the KotlinConf 2026 talk recording and a full technical write-up covering the design and evaluation.

JetBrains is upfront that this is a research prototype, not a finished product, and they’re asking for exactly the kind of feedback that stage calls for: try it on a real Kotlin/JVM project, open issues when something breaks or behaves unexpectedly, and send pull requests with real use cases. The team specifically wants examples of where asLlm and mockLlm work well — or where they don’t.

For teams already experimenting with agentic AI in their development pipelines, KotlinLLM is worth watching less for what it does today and more for the pattern it’s testing: LLM-generated logic that lives in your codebase like any other code, instead of behind an API call you have to trust every time.

Read More

Scroll to Top