How JetBrains Builds AI Agents In Kotlin Part 3: Under Observation
Original post Building AI Agents In Kotlin Part 3: Under Observation
Article Summary
Denis Domanskii from JetBrains tackles a problem every AI agent developer hits: your agent works, but you have no idea what it's actually doing or how much it's costing you.
This is part 3 of JetBrains' series on building AI coding agents in Kotlin using their Koog framework. The agent can now read files, write code, and iterate until tests pass, but debugging its behavior has become nearly impossible. Domanskii walks through integrating Langfuse observability to get full visibility into agent trajectories, costs, and failures.
Key Takeaways
- Four lines of code added Langfuse tracing to expose full agent trajectories
- 50 task evaluation run cost $66 and took 30 minutes with 10 parallel instances
- Traces immediately revealed a hidden bug in file reading tool implementation
- Per run cost tracking replaced guessing with actual OpenAI API spend data
- Verbose logs generated thousands of lines but couldn't show human readable agent behavior
Adding observability transformed a black box agent into an inspectable system that revealed bugs, showed exact costs per run, and enabled data driven optimization decisions.
Continue reading
This page summarizes “Building AI Agents In Kotlin Part 3: Under Observation” by JetBrains, published Dec 1, 2025. All credit for the original work goes to the authors.