arXiv:2611.06500cs.AINov 2026

Manuscript Offprint

arXiv:2611.06500

Tools Need Not Speak in Text: Latent Context Compression for Agents

Yuetong Liu, Zhehao Zhou, Yitong Zhang, Haorui Chen, Jia Li

Abstract

Large language model (LLM) agents typically append raw tool outputs to their context. Over multi-step interactions, long and noisy observations incur substantial context overhead and dilute the agent's attention to task-relevant information. Existing token pruning and summarization methods remain constrained by discrete text representations, limiting the achievable compression ratios.

In this work, we challenge the prevailing assumption that agents must consume tool observations as explicit text tokens. To this end, we propose Coca-Cola, a continuous latent context compression model for LLM agents. Coca-Cola compresses tool observations into latent tokens and embeds them into the input embedding space of the agent. We further introduce Action-Preserving Training, which aligns the agent's next-action distributions under full and compressed observations. This trains the compression model to learn action-sufficient latent tokens that retain decision-critical information. Experiments with web-search agents on four QA benchmarks and two model families show that Coca-Cola reduces the agent's token consumption by 70.01%–89.24% and end-to-end runtime by 24.45%–55.97%, while consistently improving task performance. These results suggest that Coca-Cola offers a promising approach for context compression in agents. Our code is available at https://github.com/THU-Agent/Coca-cola.

Date: November 5, 2026

First author: 23371522@buaa.edu.cn

Corresponding author: †\dagger jia_li@mail.tsinghua.edu.cn

1 Introduction

Large language model (LLM) agents increasingly use external tools to acquire information and solve multi-step tasks Yang et al. (2024); Hong et al. (2025); Wang et al. (2023), with web search as a representative example Schick et al. (2023); Li et al. (2025a); He et al. (2024); Li et al. (2026). Under the widely adopted ReAct Yao et al. (2022) paradigm, an agent first reasons over the task and its current context to select a tool call, then adds the returned observation to its context to take the next action. For example, after querying a search engine, a web-search agent appends the returned search results to its context and uses them to decide whether to perform another search or provide a final answer Li et al. (2025a).

However, appending raw tool observations leads to rapid context growth over successive reasoning steps, introducing two drawbacks. First, increased computational overhead. As shown in Figure 1 (left), tool observations account for a large and growing share of the context, reaching 96.7% at Step 4 and leading to substantially higher token usage and computational cost Xiao et al. (2026); Jiang et al. (2023). Second, degraded task performance. In Figure 1 (right), identifying the name Sébastien Buemi suffices to guide the next search for his birth year, while extensive race details are irrelevant to this decision. Such redundant content consumes context and can distract the model from key evidence, impairing reasoning quality Liu et al. (2024); Levy et al. (2024); Shi et al. (2023).

A natural solution is to compress the agent's context. Existing methods mainly use token pruning or text summarization. Token pruning uses a model to identify and remove less informative tokens Li et al. (2023); Jiang et al. (2023); Pan et al. (2024); Jiang et al. (2024). Text summarization uses an auxiliary LLM to condense tool outputs or interaction histories into shorter summaries Wang et al. (2026); Xu et al. (2023). However, such text-level compression has a fundamental flaw: because

Figure

Figure 1 Tool observation redundancy in LLM agents. Left: Tool returns increasingly dominate the agent context, accounting for 96.7% of total tokens by Step 4, while individual observations exhibit substantial length. Right: A representative web-search example illustrating that only a few fragments of a lengthy tool output are relevant to the agent's next decision.

the compressed result remains a discrete token sequence that must stay semantically coherent, its achievable compression ratio is inherently limited.

A closer look at tool–agent interactions raises a fundamental question: must tool outputs be expressed in textual tokens? Since these outputs primarily support an agent's subsequent reasoning and actions, tool–agent interaction need not rely on explicit textual tokens. This observation motivates us to reconsider how tool information is represented. Compared with discrete text tokens, continuous latent tokens (i.e., high-dimensional vectors in the embedding space) offer a more flexible alternative. These latent tokens can encode rich information compactly under a limited token budget, while their differentiability enables direct optimization for downstream objectives. Recent studies Yu et al. (2026); Chen et al. (2026b) have explored latent tokens in reasoning Hao et al. (2024); Cheng & Van Durme (2024); Xu et al. (2025); Deng et al. (2023); Anonymous (2026), agents' communication Ye et al. (2026); Zou et al. (2025); Du et al. (2026); Jin et al. (2026), and memory Zhang et al. (2025a; 2026); Wang et al. (2024); Zhang et al. (2025b). Together, these studies suggest that models can directly process and exchange information through latent tokens, opening up new possibilities for information transfer between tools and agents.

Motivated by this analysis, we propose Coca-Cola (Context Compression via Continuous Latent Tokens), a latent context compression model for LLM agents. Conditioned on the task instruction and the agent's current-step reasoning trajectory, Coca-Cola compresses long, noisy tool observations into a few latent tokens that retain information critical to subsequent decisions. These latent tokens are mapped into the agent's input embedding space, enabling it to use the compressed information for further reasoning and actions.

Although latent tokens enable efficient information compression, applying them to compress tool observations for agents introduces two key challenges. The first is to make compressed representations effectively usable by the agent. The second is to preserve decision-critical information under a limited representation budget. To address the first challenge, we design a context-aware encoder with a latent adapter that maps compressed representations into the target agent's input embedding space. This allows the agent to directly use these latent tokens for subsequent reasoning and actions. For the second challenge, we propose an action-preserving training method. Specifically, we align the agent's next-action distributions under full and compressed tool observations. This trains the compression model to minimize its impact on the agent's next-action behavior, thereby preserving action-critical information.

We evaluate Coca-Cola across two model configurations and four web-search QA benchmarks. Compared to uncompressed agents, Coca-Cola reduces total token consumption by 70.01%-89.24% and end-to-end runtime by 24.45%-55.97%, demonstrating substantial efficiency gains. Despite aggressive compression, Coca-Cola consistently outperforms the uncompressed agent in both EM and F1, and achieves the best EM and F1 among all methods in six of the eight model–dataset settings.

Our contributions are threefold:

  • To our knowledge, we are the first to recognize that tools need not convey information through explicit tokens and to compress tool outputs into latent tokens.

  • We propose Coca-Cola, a latent context compression model trained to preserve action-critical information.

  • Experiments on web-search agents demonstrate that Coca-Cola substantially improves efficiency while consistently improving task performance.