Building AI Agents in Kotlin – Part 4: Delegation and Sub-Agents | The JetBrains AI Blog
Blog post from JetBrains
The fourth installment of the "Building AI Agents in Kotlin" series explores the use of sub-agents to enhance efficiency and reduce costs in AI agent development. The article discusses the implementation of a "find sub-agent" using tools provided by Koog, which aims to limit context growth and improve performance by using a simpler and cheaper LLM model, GPT4.1 Mini, instead of the main agent's model. Through a strategic division of tasks, developers can maintain or improve performance while achieving a 10% cost reduction per instance, as evidenced by benchmark results. The approach mirrors team structures in software engineering, suggesting potential benefits from task specialization, although this remains an unproven strategy. Ultimately, the article highlights the potential of sub-agents to achieve cost savings while maintaining performance, paving the way for further exploration of context management and compression techniques in future installments.