How Do AI Agents Spend Your Money? Analyzing and Predicting Token Consumption in Agentic Coding Tasks
On the map: LLM agents and tool use → Agent memory systems
Abstract (arXiv)
The wide adoption of AI agents in complex human workflows is driving rapid growth in LLM token consumption. When agents are deployed on tasks that require a significant amount of tokens, three questions naturally arise: (1) Where do AI agents spend the tokens? (2) Which models are more token-efficient? and (3) Can agents predict their token usage before task execution? In this paper, we present the first systematic study of token consumption patterns in agentic coding tasks. We analyze trajectories from eight frontier LLMs on SWE-bench Verified and evaluate models' ability to predict their own token costs before task execution. We find that: (1) agentic tasks are uniquely expensive, consuming 1000x more tokens than code reasoning and code chat, with input tokens rather than output tokens driving the overall cost; (2) token usage is highly variable and inherently stochastic: runs on the same task can differ by up to 30x in total tokens, and higher token usage does not translate into higher accuracy; instead, accuracy often peaks at intermediate cost and saturates at higher costs; (3) models vary substantially in token efficiency: on the same tasks, Kimi-K2 and Claude-Sonnet-4.5, on average, consume over 1.5 million more tokens than GPT-5; (4) task difficulty rated by human experts only weakly aligns with actual token costs, revealing a fundamental gap between human-perceived complexity and the computational effort agents actually expend; and (5) frontier models fail to accurately predict their own token usage (with weak-to-moderate correlations, up to 0.39) and systematically underestimate real token costs. Our study offers new insights into the economics of AI agents and can inspire future research in this direction.
Key facts. Cited by 33 papers in the map (data through 14 Oct 2026). Placed in Agent memory systems, one of 16 directions in LLM agents and tool use. Builds on 18 of its 22 references that are in the map. First posted on arXiv 24 Apr 2026.
Builds on
18 of 22 references.
References · 18
- 2023Self-Refine: Iterative Refinement with Self-Feedbackcited by 3,442
- 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,373
- 2023Voyager: An Open-Ended Embodied Agent with Large Language Modelscited by 2,191
- 2024Scaling LLM Test-Time Compute Optimally can be More Effective than Scaling Model Parameterscited by 1,986
- 2022Language Models (Mostly) Know What They Knowcited by 1,856
- 2024OpenHands: An Open Platform for AI Software Developers as Generalist Agentscited by 1,002
- 2024Executable Code Actions Elicit Better LLM Agentscited by 564
- 2023RepoBench: Benchmarking Repository-Level Code Auto-Completion Systemscited by 353
- 2024CRUXEval: A Benchmark for Code Reasoning, Understanding and Executioncited by 300
- 2025Towards Thinking-Optimal Scaling of Test-Time Compute for LLM Reasoningcited by 119
- 2025Revisiting the Test-Time Scaling of o1-like Models: Do they Truly Possess Test-Time Scaling Capabilities?cited by 70
- 2025Inverse Scaling in Test-Time Computecited by 50
6 more
- 2025Budget-Aware Tool Use Enables Effective Agent Scalingcited by 44
- 2025OptimalThinkingBench: Evaluating Over and Underthinking in LLMscited by 35
- 2025Efficient Agents: Building Effective Agents While Reducing Costcited by 32
- 2025SWE-Effi: Re-Evaluating Software AI Agent System Effectiveness Under Resource Constraintscited by 17
- 2026Tokenomics: Quantifying Where Tokens Are Used in Agentic Software Engineeringcited by 12
- 2026The Price Reversal Phenomenon: When Cheaper Reasoning Models Cost Morecited by 4
Built on by
Citing papers per year: 2026: 33.
33 papers.
Sort:
By area:
- 2026SWE-MeM: Learning Adaptive Memory Management for Long-Horizon Coding Agentscited by 15
- 2026BAGEN: Are LLM Agents Budget-Aware?cited by 13
- 2026Token Economics for LLM Agents: A Dual-View Study from Computing and Economicscited by 6
- 2026CoACT: Action-Preserving Observation Compression for Coding Agentscited by 4
- 2026FrogNano: Training a 4B Coding Agent via Online Task Synthesiscited by 4
- 2026When Agents Coordinate: Measuring Coordination in Multi-Agent AI Codingcited by 3
- 2026Zipping the Thought: When and How Compressed Reasoning Data Works in LLM Post-Trainingcited by 2
- 2026What Should Agents Say? Action-state Communication for Efficient Multi-Agent Systemscited by 2
- 2026Reasoning effort, not tool access, buys first-try reliability in agentic code generation: an observational studycited by 2
- 2026SMetric: Rethink LLM Scheduling for Serving Agents with Balanced Session-centric Schedulingcited by 2
- 2026Markets, Not Planners: Decentralized Orchestration of LLM Agents with Private Informationcited by 2
- 2026Cost-Utility Alignment in LLM Agent Trajectories:Profiling,Attribution,Diagnosis,Adaptation,and Evaluationcited by 2
21 more
- 2026Does Code Cleanliness Affect Coding Agents? A Controlled Minimal-Pair Studycited by 1
- 2026The Token Tax of Epistemic Accuracy: Comparing RAG and Long-Context Architectures for Document-Grounded Generative AI Applicationscited by 1
- 2026The Best Programming Language for Tokenmaxxing: An Investigation of Coding Agent Behavior Across Programming Languagescited by 1
- 2026Can your AI agent be cheaper? Investigating the effects of task specifications on token spend in agentic coding taskscited by 1
- 2026MEMOA: Massive Mixtures of Online Agents via Mean-Field Decentralized Nash Equilibriacited by 0
- 2026AI Tokenomics: The Economics of Tokens, Computation, and Pricing in Foundation Modelscited by 0
- 2026ACEM: A Cost Estimation Model for Agentic Software Engineeringcited by 0
- 2026Predicting Task Difficulty Without Rolloutscited by 0
- 2026Can a Lightweight Multimodal Model Estimate LLM Reasoning Performance? A Study for Compute-Optimal Document Inferencecited by 0
- 2026AgentDecarbonizer: Carbon-Aware Execution for AI Agentscited by 0
- 2026LLM Agents as Computational Typologistscited by 0
- 2026AgentKV: Phase-Aware KV Eviction for Agentic LLMscited by 0
- 2026Analyzing and Mitigating Cost-Inefficient Behaviors in Coding Agentscited by 0
- 2026ResonAct: Streaming Metrics for Runtime Diagnosis and Self-Healing in Multi-Agent Systemscited by 0
- 2026TokenCast: Forecasting Token Consumption During LLM Agent Executioncited by 0
- 2026LongHarness Bench: Stress-Testing Language Model Harnesses for Long-Context Reasoningcited by 0
- 2026Complex Agents, Shallow Tests: Demystifying and Enhancing Test Adequacy of Agent Harness in the Wildcited by 0
- 2026Disentangling Task Difficulty from Run-Level Failure in Agent Failure Predictioncited by 0
- 2026U-Space: Uncovering When and Why Uncertainty Arises in Language Modelscited by 0
- 2026ByteMark: A Unified Byte-Level Watermark for Detection Across Language Modelscited by 0
- 2026Maximising Transparency in Context Compaction Improves Retention of Facts and Commitments for Lightweight Coding Agentscited by 0
- 2026Maximising Transparency in Context Compaction Improves Retention of Facts and Commitments for Lightweight Coding Agents14 Oct 2026
- 2026ByteMark: A Unified Byte-Level Watermark for Detection Across Language Models10 Oct 2026
- 2026U-Space: Uncovering When and Why Uncertainty Arises in Language Models6 Oct 2026
- 2026Disentangling Task Difficulty from Run-Level Failure in Agent Failure Prediction4 Oct 2026
- 2026Complex Agents, Shallow Tests: Demystifying and Enhancing Test Adequacy of Agent Harness in the Wild4 Oct 2026
- 2026LongHarness Bench: Stress-Testing Language Model Harnesses for Long-Context Reasoning29 Sep 2026
- 2026TokenCast: Forecasting Token Consumption During LLM Agent Execution28 Sep 2026
- 2026ResonAct: Streaming Metrics for Runtime Diagnosis and Self-Healing in Multi-Agent Systems28 Sep 2026
- 2026Analyzing and Mitigating Cost-Inefficient Behaviors in Coding Agents25 Sep 2026
- 2026AgentKV: Phase-Aware KV Eviction for Agentic LLMs14 Sep 2026
- 2026FrogNano: Training a 4B Coding Agent via Online Task Synthesis7 Sep 2026
- 2026LLM Agents as Computational Typologists7 Sep 2026
21 more
- 2026Can your AI agent be cheaper? Investigating the effects of task specifications on token spend in agentic coding tasks26 Aug 2026
- 2026Cost-Utility Alignment in LLM Agent Trajectories:Profiling,Attribution,Diagnosis,Adaptation,and Evaluation25 Aug 2026
- 2026Markets, Not Planners: Decentralized Orchestration of LLM Agents with Private Information24 Aug 2026
- 2026AgentDecarbonizer: Carbon-Aware Execution for AI Agents20 Aug 2026
- 2026Can a Lightweight Multimodal Model Estimate LLM Reasoning Performance? A Study for Compute-Optimal Document Inference19 Aug 2026
- 2026When Agents Coordinate: Measuring Coordination in Multi-Agent AI Coding17 Aug 2026
- 2026Predicting Task Difficulty Without Rollouts6 Aug 2026
- 2026ACEM: A Cost Estimation Model for Agentic Software Engineering3 Aug 2026
- 2026The Best Programming Language for Tokenmaxxing: An Investigation of Coding Agent Behavior Across Programming Languages24 Jul 2026
- 2026SMetric: Rethink LLM Scheduling for Serving Agents with Balanced Session-centric Scheduling9 Jul 2026
- 2026CoACT: Action-Preserving Observation Compression for Coding Agents3 Jul 2026
- 2026Reasoning effort, not tool access, buys first-try reliability in agentic code generation: an observational study2 Jul 2026
- 2026SWE-MeM: Learning Adaptive Memory Management for Long-Horizon Coding Agents26 Jun 2026
- 2026The Token Tax of Epistemic Accuracy: Comparing RAG and Long-Context Architectures for Document-Grounded Generative AI Applications18 Jun 2026
- 2026AI Tokenomics: The Economics of Tokens, Computation, and Pricing in Foundation Models10 Jun 2026
- 2026What Should Agents Say? Action-state Communication for Efficient Multi-Agent Systems3 Jun 2026
- 2026BAGEN: Are LLM Agents Budget-Aware?29 May 2026
- 2026Zipping the Thought: When and How Compressed Reasoning Data Works in LLM Post-Training27 May 2026
- 2026Does Code Cleanliness Affect Coding Agents? A Controlled Minimal-Pair Study19 May 2026
- 2026Token Economics for LLM Agents: A Dual-View Study from Computing and Economics9 May 2026
- 2026MEMOA: Massive Mixtures of Online Agents via Mean-Field Decentralized Nash Equilibria6 May 2026
- 2026SWE-MeM: Learning Adaptive Memory Management for Long-Horizon Coding Agentscited by 15
- 2026BAGEN: Are LLM Agents Budget-Aware?cited by 13
- 2026Token Economics for LLM Agents: A Dual-View Study from Computing and Economicscited by 6
- 2026CoACT: Action-Preserving Observation Compression for Coding Agentscited by 4
- 2026FrogNano: Training a 4B Coding Agent via Online Task Synthesiscited by 4
- 2026When Agents Coordinate: Measuring Coordination in Multi-Agent AI Codingcited by 3
- 2026What Should Agents Say? Action-state Communication for Efficient Multi-Agent Systemscited by 2
- 2026SMetric: Rethink LLM Scheduling for Serving Agents with Balanced Session-centric Schedulingcited by 2
- 2026Markets, Not Planners: Decentralized Orchestration of LLM Agents with Private Informationcited by 2
- 2026Cost-Utility Alignment in LLM Agent Trajectories:Profiling,Attribution,Diagnosis,Adaptation,and Evaluationcited by 2
- 2026Does Code Cleanliness Affect Coding Agents? A Controlled Minimal-Pair Studycited by 1
- 2026The Best Programming Language for Tokenmaxxing: An Investigation of Coding Agent Behavior Across Programming Languagescited by 1
12 most cited of 22 All 22 (JSON)
- 2026Maximising Transparency in Context Compaction Improves Retention of Facts and Commitments for Lightweight Coding Agents14 Oct 2026
- 2026Disentangling Task Difficulty from Run-Level Failure in Agent Failure Prediction4 Oct 2026
- 2026Complex Agents, Shallow Tests: Demystifying and Enhancing Test Adequacy of Agent Harness in the Wild4 Oct 2026
- 2026TokenCast: Forecasting Token Consumption During LLM Agent Execution28 Sep 2026
- 2026Analyzing and Mitigating Cost-Inefficient Behaviors in Coding Agents25 Sep 2026
- 2026AgentKV: Phase-Aware KV Eviction for Agentic LLMs14 Sep 2026
- 2026FrogNano: Training a 4B Coding Agent via Online Task Synthesis7 Sep 2026
- 2026LLM Agents as Computational Typologists7 Sep 2026
- 2026Can your AI agent be cheaper? Investigating the effects of task specifications on token spend in agentic coding tasks26 Aug 2026
- 2026Cost-Utility Alignment in LLM Agent Trajectories:Profiling,Attribution,Diagnosis,Adaptation,and Evaluation25 Aug 2026
- 2026Markets, Not Planners: Decentralized Orchestration of LLM Agents with Private Information24 Aug 2026
- 2026AgentDecarbonizer: Carbon-Aware Execution for AI Agents20 Aug 2026
12 newest of 22 All 22 (JSON)
- 2026Zipping the Thought: When and How Compressed Reasoning Data Works in LLM Post-Trainingcited by 2
- 2026Reasoning effort, not tool access, buys first-try reliability in agentic code generation: an observational studycited by 2
- 2026Can a Lightweight Multimodal Model Estimate LLM Reasoning Performance? A Study for Compute-Optimal Document Inferencecited by 0
- 2026LongHarness Bench: Stress-Testing Language Model Harnesses for Long-Context Reasoningcited by 0
- 2026LongHarness Bench: Stress-Testing Language Model Harnesses for Long-Context Reasoning29 Sep 2026
- 2026Can a Lightweight Multimodal Model Estimate LLM Reasoning Performance? A Study for Compute-Optimal Document Inference19 Aug 2026
- 2026Reasoning effort, not tool access, buys first-try reliability in agentic code generation: an observational study2 Jul 2026
- 2026Zipping the Thought: When and How Compressed Reasoning Data Works in LLM Post-Training27 May 2026
- 2026The Token Tax of Epistemic Accuracy: Comparing RAG and Long-Context Architectures for Document-Grounded Generative AI Applicationscited by 1
- 2026MEMOA: Massive Mixtures of Online Agents via Mean-Field Decentralized Nash Equilibriacited by 0
- 2026AI Tokenomics: The Economics of Tokens, Computation, and Pricing in Foundation Modelscited by 0
- 2026Predicting Task Difficulty Without Rolloutscited by 0
- 2026ResonAct: Streaming Metrics for Runtime Diagnosis and Self-Healing in Multi-Agent Systemscited by 0
- 2026U-Space: Uncovering When and Why Uncertainty Arises in Language Modelscited by 0
- 2026U-Space: Uncovering When and Why Uncertainty Arises in Language Models6 Oct 2026
- 2026ResonAct: Streaming Metrics for Runtime Diagnosis and Self-Healing in Multi-Agent Systems28 Sep 2026
- 2026Predicting Task Difficulty Without Rollouts6 Aug 2026
- 2026The Token Tax of Epistemic Accuracy: Comparing RAG and Long-Context Architectures for Document-Grounded Generative AI Applications18 Jun 2026
- 2026AI Tokenomics: The Economics of Tokens, Computation, and Pricing in Foundation Models10 Jun 2026
- 2026MEMOA: Massive Mixtures of Online Agents via Mean-Field Decentralized Nash Equilibria6 May 2026
Similar, not cited
Close in wording, no citation either way
- 2026Beyond Token Savings: A Systematic Study of Context Compression in LLM Agents
- 2026Agentic Coding in the Wild: Characterizing GitHub Copilot Traces at Production Scale
- 2026The Harness Effect: How Orchestration Design Sets the Token Economics of Enterprise Agentic AI
- 2026TraceLab: Characterizing Coding Agent Workloads for LLM Serving
- 2026On the Impact of AGENTS.md Files on the Efficiency of AI Coding Agents
- 2026Are Online Skill and Memory Modules Always Worth Their Tokens? A Budget-Constrained Study of Web Agents
- 2026Agentic AI Systems Should Be Designed as Marginal Token Allocators
- 2026How Do AI Coding Agents Contribute to Software Development? an Empirical Study of Agentic Pull Requests