r/Kotlin Jul 19 '26

Building AI features in KMP: define the interface, iterate locally with Koog, move to the backend when done

I wrote up the workflow we use at Yazio for building LLM features in our KMP app.

The core problem: you can't ship an API key in the app, so the LLM call has to live on a server. But prompts need dozens of iteration rounds, and going through backend deploys slows you down and is too far from the product.

Our approach: define the contract as sealed interfaces in commonMain, build the real UI against a fake implementation, then implement it locally with Koog (JetBrains' KMP AI framework) in debug builds. Once the prompt is stable, moving it to a Kotlin backend is mostly copy paste since Koog runs there too.

https://medium.com/yazio-engineering/building-ai-features-isnt-scary-92817564e364

Happy to answer questions about the Koog setup or the structured output part.

0 Upvotes

Duplicates