Source: Preliminary findings from the JetBrains Developer Ecosystem Survey 2026 • 15,000+ developers worldwide

Mistake
Why it increases cost
Better approach
Sending full conversation history every turn
Every model call includes all previous turns as input tokens
Summarize or trim history, passing only what the current step needs
Retrieving too many chunks
Large context payloads on every call, much of it irrelevant
Use tighter retrieval with more specific queries and cap chunk count
Route simple tasks to cheaper models
Frontier models cost significantly more per call than smaller models
Using the largest model for every step
Set retry budgets and stop conditions, then escalate after a set number of failures
Each attempt re-sends everything accumulated so far
Allowing unlimited retries
Design handoffs to pass only what the next agent needs
Agents receive overlapping context when roles aren't clearly scoped
Running redundant multi-agent workflows
Cache stable outputs and invalidate when source data changes
Repeated classification, retrieval, or summarization results are regenerated each time
Not caching reusable results
Add explicit failure handling and loop detection
Measure total cost per workflow before tuning individual prompts or calls
Track cost at the workflow and agent level, not just the account
Unhandled failures trigger replanning cycles that add token usage
You may improve the wrong thing and miss the actual cost driver
High-cost workflows hide inside aggregated totals
Ignoring failed tool-call loops
Optimizing token cost before measuring workflow cost
Measuring only total spend, not cost per workflow
A single LLM prompt may require only one model call. An agent workflow can involve multiple calls for planning, tool use, validation, and retries, often carrying substantial context between steps. The total cost, therefore, depends on the workflow as a whole rather than on any single call. A workflow can be expensive even when every prompt in it looks cheap.
Workflows with retry loops, multi-agent handoffs with overlapping context, long conversation histories sent on every call, and high-frequency tool use generate the most token spend. Repository exploration is a common one in coding work: with no index to query, an agent rebuilds its picture of the codebase from scratch on every task.
Start by measuring which workflows generate the most cost. The biggest savings come from removing unnecessary context, eliminating redundant reasoning, and caching reusable results rather than shortening system prompts. Routing simpler tasks to smaller models reduces costs without compromising the quality of complex reasoning.
Start with the workflows your usage reports already show as most expensive, rather than covering everything at once. Define retry budgets and tool call limits inside individual workflows, then use organization-level controls to cap total consumption by team or group. Review the reports on a cadence, not after a billing surprise.
Damaso Sanoja is an engineer who is passionate about helping others make data-driven decisions to achieve their goals. This has motivated him to write numerous articles on the most popular relational databases, customer relationship management systems, enterprise resource planning systems, master data management tools, and, more recently, data warehouse systems used for machine learning and AI projects. You can blame this fixation on data management on his first computer being a Commodore 64 without a floppy disk.
Explore JetBrains AI solutions that help you build, use, and scale AI agents across the software development lifecycle.
Run terminal agents through one JetBrains account, with access, models, and usage governed centrally.
Plan, code, debug, and automate tasks with a coding agent that works across your terminal, IDE, GitHub, and GitLab.
Orchestrate AI agents and verify their output directly in JetBrains IDEs, with full control over how changes are reviewed.
Automate software delivery workflows, coordinate agentic work across teams, identify bottlenecks affecting delivery.
Govern AI usage, models, policies, and costs across your organization, including JetBrains and third-party tools.
Give agents shared organizational memory and context that carries across tools, workflows, and execution environments.
An open system of AI products for developers, teams, and organizations – from coding with agents to automating workflows and governing AI at scale.
Continue Exploring the AI Agents for Developers Guide
Learn how to manage AI agent context windows, reduce context loss, and improve performance, accuracy, and reliability in long-running workflows.
Learn how AI agent orchestration works, from planning and task routing to state management, multi-agent coordination.
Explains how AI agent loops work, why infinite loops occur, and practical techniques for preventing runaway execution in production systems.