The JVM Speaks AI: Cobrainer's Journey with Kotlin, Koog and Exposed
说明与用途
Cobrainer 将 AI 集成统一到单一 Kotlin 单体仓库,使用 Koog 实现了零停机、5 倍吞吐量,并在一天内向所有客户发布。
问题
A large customer triggered a burst of AI‑assisted work, causing one LLM provider to throttle Cobrainer’s services. The system needed a reliable fallback and circuit‑breaking mechanism to keep the workflow uninterrupted.
结果
By consolidating AI integration into Kotlin with Koog, Cobrainer achieved zero‑downtime during provider throttling, 5× throughput gains, and a single‑day rollout to all customers.
工作流
- 1. Identify LLM framework requirements: lean, explicit, rapid release cadence, clean provider abstractions, end‑to‑end type safety.
- 2. Evaluate Spring AI, LangChain4j, and Koog by building production‑ready prototypes.
- 3. Choose Koog for its Kotlin‑centric design and explicit contract handling.
- 4. Refactor existing AI code to use Koog’s DSL and sealed‑hierarchy contracts.
- 5. Implement cross‑provider fallback chains and circuit breakers.
- 6. Deploy the new stack to all customers in one day.
- 7. Monitor with LLMObs and enforce contract tests.
证据
One afternoon, one of our LLM providers started throttling us. A large customer had triggered a burst of AI‑assisted work, and the provider's capacity in our region could not keep up.
We built all of our AI integration in Kotlin. ... Every prompt, agent, and structured‑output contract in our core platform lives on the JVM: one Kotlin monorepo with types shared end to end, built on Koog, Exposed, coroutines, and kotlinx.serialization.
Production reliability comes from cross‑provider fallback chains, circuit breakers, LLMObs, and contract tests. Removing blocking code from coroutine paths also increased throughput by 5×.
Once we chose Koog, we cleaned up the proof of concept and rolled it out to all customers in one day.
- 记录日期: 2026-10-13T08:41:26.204Z