<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/prompts-that-can-write-themselves-a-kotlin-experiment-tqerozhug" -->

---
title: Prompts That Can Write Themselves: A Kotlin Experiment
description: JetBrains Research released the Koog Agents Optimization Library, a research library for optimizing the prompts of agents built with Koog, its Kotlin agent...
canonical: https://daily.dev/posts/prompts-that-can-write-themselves-a-kotlin-experiment-tqerozhug
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Prompts That Can Write Themselves: A Kotlin Experiment | daily.dev
og:description: JetBrains Research released the Koog Agents Optimization Library, a research library for optimizing the prompts of agents built with Koog, its Kotlin agent...
og:url: https://daily.dev/posts/prompts-that-can-write-themselves-a-kotlin-experiment-tqerozhug
og:image: https://api.daily.dev/og/posts/TQeROzHuG.png
og:image:alt: Prompts That Can Write Themselves: A Kotlin Experiment
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Prompts That Can Write Themselves: A Kotlin Experiment

**[JetBrains](https://daily.dev/sources/jetbrains)** · 7 min read · 1 upvotes · 0 comments

## Summary

JetBrains Research released the Koog Agents Optimization Library, a research library for optimizing the prompts of agents built with Koog, its Kotlin agent framework. You mark specific steps as optimizable, give it a training set and a scoring function, and the library runs the agent, learns from failures, and hands back better instructions as a JSON file. Using the GEPA optimizer on the PUPA privacy benchmark, the agent's score rose from 81.19 to 94.22. The library also implements three other optimizers: BootstrapFewShot, MIPROv2, and ACE, all behind the same train/loadOptimizedAgent interface.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.jetbrains.com/research/2026/10/koog-agents-optimization-library-prompts>

## Questions this post answers

### How does the GEPA optimizer improve prompts for Koog agents in Kotlin?

GEPA runs the agent over a training set, shows a second model what went wrong, and asks it to write a better instruction, repeating this across rounds while keeping multiple candidate instructions alive. On the PUPA privacy benchmark, this raised the agent's score from a baseline of 81.19 to 94.22, a statistically significant 13-point gain across five runs.

_daily.dev surfaces practical writeups like this for developers tuning agent prompts in Kotlin._

### How do I mark a step as optimizable in JetBrains' Koog agent framework?

Swap the subgraphWithTask builder for optimizableSubgraphWithTask on the step you want tuned, and pass the instruction as a separate optimizableInstruction parameter instead of embedding it in a string. The graph structure stays unchanged; the instruction just moves into a parameter an optimizer can read and replace, and the step runs on the original text until an optimized artifact is loaded.

_follow daily.dev for Kotlin agent tooling updates when building or tuning Koog pipelines._

### What other prompt optimizers besides GEPA are available for AI agent frameworks?

Three alternatives ship behind the same interface as GEPA: BootstrapFewShot, which mines demonstrations from successful runs and makes no extra LLM calls beyond running the agent itself, making it the cheapest to try; MIPROv2, which searches across both instructions and demonstrations; and ACE, which grows an accumulating playbook of insights alongside the system prompt.

_developers comparing agent-optimization approaches can track new releases like this on daily.dev._

## Similar posts on daily.dev

- [Building AI Agents in Kotlin – Part 1: A Minimal Coding Agent](https://daily.dev/posts/building-ai-agents-in-kotlin-part-1-a-minimal-coding-agent-qj6gulzea) · JetBrains · 0 upvotes · 0 comments
- [Prompt Optimization Agents and Techniques: Designing Systems That Improve Prompts on Purpose](https://daily.dev/posts/prompt-optimization-agents-and-techniques-designing-systems-that-improve-prompts-on-purpose-ewnowtyia) · C\# Corner · 0 upvotes · 0 comments

---

Tags: [#ai-agents](https://daily.dev/tags/ai-agents), [#kotlin](https://daily.dev/tags/kotlin), [#jetbrains](https://daily.dev/tags/jetbrains)

[View this post on daily.dev](https://daily.dev/posts/prompts-that-can-write-themselves-a-kotlin-experiment-tqerozhug)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Prompts That Can Write Themselves: A Kotlin Experiment","url":"https://daily.dev/posts/prompts-that-can-write-themselves-a-kotlin-experiment-tqerozhug","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/prompts-that-can-write-themselves-a-kotlin-experiment-tqerozhug"},"datePublished":"2026-10-29T13:17:25.086Z","dateModified":"2026-10-29T13:18:22.251Z","description":"JetBrains Research released the Koog Agents Optimization Library, a research library for optimizing the prompts of agents built with Koog, its Kotlin agent...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ea8b00827c981dcca89b8dfb201cf3b3?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ea8b00827c981dcca89b8dfb201cf3b3?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"JetBrains","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"JetBrains","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/53ecf0c676f34b3896ee109609d91efa","url":"https://daily.dev/sources/jetbrains"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/prompts-that-can-write-themselves-a-kotlin-experiment-tqerozhug","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"ai-agents,kotlin,jetbrains","timeRequired":"PT7M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"JetBrains","item":"https://daily.dev/sources/jetbrains"},{"@type":"ListItem","position":3,"name":"Prompts That Can Write Themselves: A Kotlin Experiment"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/prompts-that-can-write-themselves-a-kotlin-experiment-tqerozhug#faq","mainEntity":[{"@type":"Question","name":"How does the GEPA optimizer improve prompts for Koog agents in Kotlin?","acceptedAnswer":{"@type":"Answer","text":"GEPA runs the agent over a training set, shows a second model what went wrong, and asks it to write a better instruction, repeating this across rounds while keeping multiple candidate instructions alive. On the PUPA privacy benchmark, this raised the agent's score from a baseline of 81.19 to 94.22, a statistically significant 13-point gain across five runs. daily.dev surfaces practical writeups like this for developers tuning agent prompts in Kotlin."}},{"@type":"Question","name":"How do I mark a step as optimizable in JetBrains' Koog agent framework?","acceptedAnswer":{"@type":"Answer","text":"Swap the subgraphWithTask builder for optimizableSubgraphWithTask on the step you want tuned, and pass the instruction as a separate optimizableInstruction parameter instead of embedding it in a string. The graph structure stays unchanged; the instruction just moves into a parameter an optimizer can read and replace, and the step runs on the original text until an optimized artifact is loaded. follow daily.dev for Kotlin agent tooling updates when building or tuning Koog pipelines."}},{"@type":"Question","name":"What other prompt optimizers besides GEPA are available for AI agent frameworks?","acceptedAnswer":{"@type":"Answer","text":"Three alternatives ship behind the same interface as GEPA: BootstrapFewShot, which mines demonstrations from successful runs and makes no extra LLM calls beyond running the agent itself, making it the cheapest to try; MIPROv2, which searches across both instructions and demonstrations; and ACE, which grows an accumulating playbook of insights alongside the system prompt. developers comparing agent-optimization approaches can track new releases like this on daily.dev."}}]}
```

