TokenCast: Forecasting Token Consumption During LLM Agent Execution
On the map: LLM agents and tool use → Tool learning and function calling
Abstract (arXiv)
When a large language model (LLM) agent executes the same task, token consumption can vary by over an order of magnitude across runs. The agent chooses its next steps based on tool feedback and intermediate results, while the growing context steadily inflates the input size of every subsequent call. The total consumption of a task is therefore hard to predict before execution and the prediction must be revised as the run unfolds. In this paper, we propose TokenCast, which learns a composable cost representation for each execution segment, recording its own consumption and the context growth it introduces. Composing adjacent segments yields a cumulative estimate that captures the extra input cost incurred when context from earlier segments is re-read by every later call. As execution unfolds, newly observed evidence refreshes the forecast, requiring no additional LLM calls and incurring a mean cumulative prediction time of 32.8 ms per run on SWE-bench Verified. Across 4 task suites and 6 agent models, TokenCast's mean absolute error reduction against the strongest comparator averages 14.5% over 96 evaluated combinations. In offline budget-control replay, TokenCast uses 21.3% fewer tokens on average than a fixed-budget policy at matched trace completion. The code is available at https://github.com/DEFENSE-SEU/TokenCast.
Key facts. No citing papers in the map yet (data through 7 Oct 2026). Placed in Tool learning and function calling, one of 16 directions in LLM agents and tool use. Builds on 35 of its 57 references that are in the map. First posted on arXiv 28 Sep 2026.
Builds on
35 of 57 references.
Closest ancestors · 1
Same direction, newest first
Other references · 34
- 2022ReAct: Synergizing Reasoning and Acting in Language Modelscited by 8,355
- 2023Efficient Memory Management for Large Language Model Serving with PagedAttentioncited by 5,767
- 2018HotpotQA: A Dataset for Diverse, Explainable Multi-hop Question Answeringcited by 3,686
- 2017TriviaQA: A Large Scale Distantly Supervised Challenge Dataset for Reading Comprehensioncited by 2,895
- 2024MMLU-Pro: A More Robust and Challenging Multi-Task Language Understanding Benchmarkcited by 1,758
- 2024SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineeringcited by 1,628
- 2025Search-R1: Training LLMs to Reason and Leverage Search Engines with Reinforcement Learningcited by 1,371
- 2020Constructing A Multi-hop QA Dataset for Comprehensive Evaluation of Reasoning Stepscited by 1,259
- 2023SGLang: Efficient Execution of Structured Language Model Programscited by 1,107
- 2022When Not to Trust Language Models: Investigating Effectiveness of Parametric and Non-Parametric Memoriescited by 1,103
- 2022Measuring and Narrowing the Compositionality Gap in Language Modelscited by 1,054
- 2024OpenHands: An Open Platform for AI Software Developers as Generalist Agentscited by 956
22 more
- 2021MuSiQue: Multihop Questions via Single-hop Question Compositioncited by 893
- 2023DSPy: Compiling Declarative Language Model Calls into Self-Improving Pipelinescited by 803
- 2023C-Pack: Packed Resources For General Chinese Embeddingscited by 556
- 2024Executable Code Actions Elicit Better LLM Agentscited by 537
- 2024LongBench v2: Towards Deeper Understanding and Reasoning on Realistic Long-context Multitaskscited by 367
- 2024FlashRAG: A Modular Toolkit for Efficient Retrieval-Augmented Generation Researchcited by 165
- 2024Parrot: Efficient Serving of LLM-based Applications with Semantic Variablecited by 96
- 2024Efficient LLM Scheduling by Learning to Rankcited by 83
- 2023S3: Increasing GPU Utilization during Generative Inference for Higher Throughputcited by 81
- 2024Efficient Interactive LLM Serving with Proxy Model-based Sequence Length Predictioncited by 64
- 2025Reducing Cost of LLM Agents with Trajectory Reductioncited by 44
- 2024Don't Stop Me Now: Embedding Based Scheduling for LLMscited by 34
- 2026How Do AI Agents Spend Your Money? Analyzing and Predicting Token Consumption in Agentic Coding Taskscited by 28
- 2026TraceLab: Characterizing Coding Agent Workloads for LLM Servingcited by 14
- 2026Tokenomics: Quantifying Where Tokens Are Used in Agentic Software Engineeringcited by 11
- 2026Predicting LLM Output Length via Entropy-Guided Representationscited by 9
- 2026Scheduling LLM Inference with Uncertainty-Aware Output Length Predictionscited by 7
- 2026Pythia: Exploiting Workflow Predictability for Efficient Agent-Native LLM Servingcited by 6
- 2026Token Economics for LLM Agents: A Dual-View Study from Computing and Economicscited by 5
- 2026Chimera: Latency- and Performance-Aware Multi-agent Serving for Heterogeneous LLMscited by 4
- 2026Robust Length Prediction: A Perspective from Heavy-Tailed Prompt-Conditioned Distributionscited by 3
- 2026How Much is Left? LLMs Linearly Encode Their Remaining Output Lengthcited by 2
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2026Beyond Token Savings: A Systematic Study of Context Compression in LLM Agents
- 2026Good to Go: The LOOP Skill Engine That Hits 99% Success and Slashes Token Usage by 99% via One-Shot Recording and Deterministic Replay
- 2026Chronicle: Cut-Point Replay for Regression Testing of LLM Agents
- 2026TVCACHE: A Stateful Tool-Value Cache for Post-Training LLM Agents
- 2026Knowledge-Based Zero-Replay Debugging of Multi-Agent LLM Traces
- 2026When Agents Slow Down: Understanding LLM Agents' Test-Time Strategies via Elo-per-token Analysis
- 2026CAST: Critique-Aware Supervision for Training Reliable Long-Horizon Tool-Calling Agents
- 2026TokenPilot: Cache-Efficient Context Management for LLM Agents