This New Library Automatically Improves Your AI Prompts

TL;DR: JetBrains has released a new open-source library that automatically fine-tunes instructions for AI agents. The tool helps developers optimize prompts by learning from test runs, saving significant time and improving the agent's final output.
Key facts
- Category
- AI
- Impact
- High
- Published
- Source
- JetBrains Blog
Full summary
JetBrains released a new open-source library that automatically learns from test runs to improve and optimize instructions for AI agents.
JetBrains Research has introduced a new open-source tool aimed at one of the biggest challenges in AI development: perfecting the instructions given to AI agents. According to a post on the JetBrains Blog, the new Koog Agents Optimization Library is an experimental project designed to automate the process of prompt optimization. Instead of developers manually tweaking and re-testing prompts through trial and error, this Kotlin-based library provides a systematic way to discover more effective instructions. The library allows developers to take an initial draft of a prompt, provide examples of desired outcomes, and let the tool automatically run tests to find a better-performing version. This shifts prompt engineering from an intuitive art into a more structured, repeatable engineering discipline.
The library operates on a simple yet powerful principle: automated, iterative improvement. A developer begins by writing the initial set of instructions for their AI agent, just as they normally would. However, they then identify specific parts of the prompt—individual steps or phrases—that they believe could be improved, marking them as candidates for tuning. The next step is to provide the library with a training dataset, which consists of inputs and their corresponding ideal outputs. Finally, the developer must define a scoring function, which is a piece of code that evaluates the agent's generated output and assigns it a numerical score based on how well it matches the desired result. With these pieces in place, the library takes over, repeatedly running the agent with slight variations of the marked prompt sections, learning from the scores, and gradually converging on a set of instructions that consistently produces higher-quality results.
This project fits into a broader industry trend of trying to tame the complexity of building with large language models (LLMs). Currently, "prompt engineering" is often a manual and unpredictable process that can consume a significant portion of a project's development time. While tools like prompt management platforms help organize and version prompts, they don't typically automate the creative process of improving them. The Koog library represents a more fundamental approach, treating prompts not as static text but as parameters in a system that can be optimized. This mirrors the evolution seen in traditional software and machine learning, where practices like continuous integration and hyperparameter tuning brought automation and rigor to development. By creating a framework for programmatic prompt improvement, JetBrains is helping to establish the foundations for what could be called "LLMOps," applying proven engineering principles to the new world of generative AI.
For developers, CTOs, and founders, the practical takeaway is that the tools for building reliable AI are rapidly maturing. While the Koog library is currently presented as a research project and is specific to the Kotlin ecosystem, its core concept is a signal of where the industry is headed. The need for a good training set and a well-defined scoring metric remains a significant hurdle, but the automation of the tuning process itself is a major step forward. Teams building AI products should watch for these kinds of optimization tools to become more mainstream and integrated into developer environments. In the near future, we can expect IDEs to offer features that suggest prompt improvements or even run optimization cycles in the background, freeing up developers to focus on higher-level application logic rather than the minutiae of LLM communication.
Why it matters
Prompt engineering is often a manual, time-consuming process of trial and error. This library introduces a systematic, automated approach to optimization, allowing developers to treat prompt tuning as a structured engineering problem rather than an art. It could significantly accelerate AI agent development cycles.
Business impact
Automating prompt optimization can reduce the significant labor costs associated with developing reliable AI agents. This allows teams to build and deploy more effective AI-powered products faster, creating a competitive advantage by improving both development speed and the quality of the final user experience.
Tags
Related on Notifire
Related stories
Primary source: JetBrains Blog