Observation masking is a context-management strategy for LLM-based agents in which older environment observations are simply omitted from the agent’s context history, instead of the history being compressed with LLM-based summarization. It addresses the long, expensive context histories that agents accumulate through iterative reasoning, exploration and tool use.
Usage
The Complexity Trap: Simple Observation Masking Is as Efficient as LLM Summarization for Agent Context Management compares observation masking with LLM summarization, the approach it says state-of-the-art software engineering agents such as OpenHands and Cursor use. Within SWE-Agent on SWE-Bench Verified, across five model configurations, that paper finds that simple environment observation masking halves cost relative to the raw agent while matching, and sometimes slightly exceeding, the solve rate of LLM summarization. The same paper introduces a hybrid approach that reduces costs by a further 7% compared with observation masking alone and 11% compared with LLM summarization alone.
When It Applies
The strategy applies to LLM agents whose iterative tool use produces long context histories, and the evidence for it comes from software engineering agents. How well-established it is rests on one study’s measured results: the comparison above was run in SWE-agent on SWE-bench Verified, and the paper describes its evidence that the findings generalize to the OpenHands agent scaffold as initial. Its authors present the result as raising concerns about the trend towards pure LLM summarization.
Related Terms
- Compaction — a related approach to keeping an agent’s context within bounds
- Context engineering — the broader practice of managing what enters an agent’s context