Prompts That Can Write Themselves: A Kotlin Experiment JetBrains Research released the Koog Agents Optimization Library, a research library that tunes the prompts of Koog agents without requiring the agent to be rewritten, and reported that the GEPA prompt optimizer raised its PAPILLON privacy agent's score on the PUPA benchmark from 81.19 to 94.22. Developers mark steps worth tuning with the optimizableSubgraphWithTask builder, supply a training set and a scoring method, and the library returns improved instructions as a separate JSON file that can be reviewed and committed. The library is published on GitHub with documentation and examples. JetBrains Research Research is crucial for progress and innovation, which is why at JetBrains we are passionate about both scientific and market research Research https://blog.jetbrains.com/research/category/research/ Prompts That Can Write Themselves: A Kotlin Experiment TL;DR Koog Agents Optimization Library is a research library developed by JetBrains Research for optimizing the prompts of Koog agents. With it, you write a first version of each instruction, mark the steps worth tuning, provide the library with a training set, and specify a way to score the agent’s output. The library then runs your agent, learns from what happens, and hands back better instructions as a separate JSON file you can read, review, and commit. No rewrite of the agent is needed. The examples in this post use GEPA https://github.com/gepa-ai/gepa , a prompt optimizer that learns from your agent’s failures and successes. In this post, we walk you through examples running on the privacy benchmark PUPA https://huggingface.co/datasets/Columbia-NLP/PUPA . GEPA improved our agent’s score from 81.19 to 94.22. 👉 Koog Agent Optimization Library GitHub https://github.com/JetBrains/koog-auto-agent-optimization-lib 👉 Docs https://jetbrains.github.io/koog-auto-agent-optimization-lib/ 👉 Examples https://github.com/JetBrains/koog-auto-agent-optimization-lib/tree/main/koog-optimization-examples An agent to optimize Koog https://github.com/JetBrains/koog is JetBrains’ Kotlin framework for building agents. It treats an agent as a program: you declare control flow as a typed graph of nodes and edges, and each step can carry its own prompt, tools, and model. We have a whole agent written in it: our port of PAPILLON https://arxiv.org/abs/2410.17127 , a privacy pipeline that GEPA uses as one of its benchmarks. It runs on PUPA https://huggingface.co/datasets/Columbia-NLP/PUPA , a dataset of user queries that carry personal details. The agent has to answer such a query with help from a big external model without handing that model any of those details, so it rewrites the question without the details, sends that version out, and writes the reply from what comes back. fun pupaStrategy untrustedModel: LLModel = strategy "pupa-papillon" { val craftRedactedRequest by subgraphWithTask