Manuscript Offprint
arXiv:2610.24955MemPrice: Online Memory Allocation via Adaptive Pricing for Long-Horizon Agents
ABSTRACT
Long-horizon LLM agents face a fundamental allocation problem as interaction histories grow: which information to retain, how much context to devote to it, and at what granularity. Existing memory mechanisms largely focus on relevance, retrieval, or compression, leaving this allocation trade-off implicit. We introduce MEMPRICE, which treats active context as a shared resource and dynamically allocates it across memories and representation levels. MEMPRICE turns accumulated memory pressure into an adaptive price on context, encouraging detail only when its estimated retention value justifies the additional footprint. This pressure persists across memory refreshes, allowing the contents of memory to evolve while preserving long-run control over context usage. We show that irreversible compression can force linear worst-case regret against hindsight following its own memory trajectory, and introduce a same-state benchmark to evaluate allocation on MEMPRICE's realized memory states. MEMPRICE enforces the hard context budget at every round and regulates long-run occupancy through adaptive pricing, without prior knowledge of the interaction horizon. Under priced-frontier regularity, its average allocation-regret bound against this benchmark vanishes when accumulated estimation error is sublinear. We evaluate the framework under matched memory budgets on LongMemEval, LoCoMo, AppWorld, and WebShop across three foundation models, spanning both query-blind memory construction and goal-directed agent context management. The complete experimental code and reproduction scripts are available in our anonymous repository at https://anonymous.4open.science/r/ICLR2027-MemPrice.
1 INTRODUCTION
Foundation models are increasingly deployed as long-horizon agents that reason, act, and interact over extended trajectories (Yao et al., 2023; Shinn et al., 2023). As these interactions grow, the accumulated history can quickly exceed the active context available to the model, making memory management a central component of agent design. Existing systems address this challenge through persistent memory, hierarchical storage, retrieval, summarization, and adaptive context construction (Park et al., 2023; Packer et al., 2023; Xu et al., 2025). More recent methods further predict which past information will matter for upcoming decisions or dynamically compress interaction trajectories to control context growth (Wei et al., 2026; Ye et al., 2026). Together, these advances substantially improve an agent's ability to operate beyond a fixed context window.
However, most existing approaches formulate memory management primarily as a problem of retrieval, relevance estimation, or compression, leaving the underlying allocation of context capacity largely implicit. Knowing that a memory is relevant does not determine whether it is worth the space it consumes: a detailed record may provide only slightly more value than a compact summary while occupying substantially more context, and retaining one item necessarily reduces the capacity available to others. Similarity, importance, or predicted relevance scores therefore do not directly capture the opportunity cost of memory occupancy. Moreover, this trade-off changes over time as new information arrives and the user's informational needs evolve. Once information has
Equal contribution.
Corresponding author.
been compressed or discarded, early allocation mistakes may also be irreversible until the memory is refreshed. We argue that these effects are better understood by treating active context explicitly as a limited resource: rather than only asking what information is relevant, an agent must decide which information deserves memory, at what granularity, and at what cost.
To this end, we introduce MEMPRICE, a memory-allocation framework that makes the opportunity cost of active context explicit. Each memory can be retained at multiple levels of detail, while a persistent virtual queue turns accumulated occupancy pressure into a shared price on context. MEMPRICE then jointly chooses representations under the hard context budget, retaining finer detail only when its estimated retention value warrants the additional footprint. Crucially, the queue persists across memory refreshes, so retrieval can change what is brought back into context without erasing the resource pressure accumulated over the interaction. Irreversible compression changes which representations remain available, so hindsight may benefit from having preserved different information, not just from better allocation. We therefore evaluate allocation on MEMPRICE's realized memory-state trajectory, while still allowing hindsight to redistribute occupancy across time. MEMPRICE always satisfies hard capacity and, under bounded utilities and estimation error, drives excess average occupancy to zero without knowing the interaction horizon. Under priced-frontier regularity, its average-regret bound against this same-state benchmark also vanishes when estimation error accumulates sublinearly. We evaluate the framework under two complementary regimes: Query-Blind Memory, where the eventual question is revealed only after a long interaction, and Goal-Observable Memory, where the target is known from the outset and relevant evidence must be accumulated over time. Our main contributions are:
• We formulate long-horizon agent memory management as an explicit online resource-allocation problem, and propose MEMPRICE, which combines capacity-feasible representation selection with persistent memory pricing to adapt allocation over time while decoupling semantic refresh from resource accounting.
• We prove a linear worst-case regret lower bound against independent-state hindsight and introduce a same-state benchmark. Under stated assumptions, MEMPRICE admits regret bounds with explicit estimation-error and priced-frontier terms, and cumulative occupancy violation.
• We evaluate memory allocation under two complementary settings: Query-Blind, where future information needs are unknown during memory construction, and Goal-Observable, where the task goal is known from the outset and can guide evidence accumulation. Our method achieves strong results in both settings.
Relation to prior work. Long-horizon agents often rely on persistent memory to preserve and recover useful information over time (Shinn et al., 2023; Park et al., 2023; Packer et al., 2023; Chhikara et al., 2025; Xu et al., 2025). Recent work further adapts the contents and granularity of working context through trajectory folding and relevance-aware context construction (Sun et al., 2025; Ye et al., 2026; Wei et al., 2026). We view active context as a shared resource and formulate memory management as an online allocation problem across competing memories and representation levels, connecting agent memory to online resource allocation and long-term constrained optimization (Devanur & Jain, 2012; Agrawal et al., 2014; Jenatton et al., 2016; Yu et al., 2017; Zong & Jiang, 2026). MemPrice realizes this view through adaptive pricing and persistent resource accounting across memory refreshes. A detailed discussion of related work is provided in Appendix A.
Let denote the hard active-context capacity, and let specify the target average occupancy ratio. At round , the allocator chooses , where is the feasible set induced by the current memory state. Let and denote retention utility and memory occupancy, and define . For a non-anticipating policy , the finite-prefix reference objective
Existing work: what to remember, but not how much to allocate

Figure 1: Comparison of existing works and ours.
is
The feasible sets are induced by the memory-state trajectory generated by .
Memory representation choices. Let denote the set of memory items currently resident in active context at round . Each item can be retained at one of five representation levels,
ordered from more detailed to more compressed representations. Let denote the representation of item available immediately before the round- allocation. Between memory refreshes, compression is one-way: the allocator may keep an item’s current representation or move to a coarser level, but cannot recover discarded detail. For item at representation level , let denote its memory footprint. Coarser representations use no more memory, with deletion having zero footprint. For an allocation , its total memory occupancy is . The feasible allocation set in Eq. equation 1 is therefore
Let denote the true retention utility of keeping item at representation . We assume that retention utility does not increase under further compression and vanishes upon deletion. At each round, an LLM oracle provides utility estimates for the feasible representation choices. Let
Throughout the analysis, denotes the allocation-level retention objective; Section 5 evaluates how the resulting memory policies translate to downstream task performance.
Updated price for next round

Figure 2: An overview of our MemPrice framework.
Memory refresh. The interaction is organized into consecutive refresh windows of L rounds, except possibly for the final window. Within each window, the resident set consists of the context carried from the previous boundary together with newly observed interaction items. Motivated by persistent-memory designs that retain interaction history for later retrieval, we store raw transcripts in an external archive and use a fixed compression–retrieval pipeline at refresh boundaries to construct the carried context for the next window. Thus, compression is irreversible within a refresh window but archived information can be recovered at subsequent boundaries. Memory occupancy and retention utility are defined over the active context only.
3 ALGORITHM
MemPrice controls active-context allocation through a history-dependent memory price. At each round, accumulated occupancy pressure determines the current memory price. The allocator then jointly selects a representation for each resident memory, retaining additional detail only when its estimated value justifies the corresponding context cost. This pressure carries across memory refreshes, allowing the agent to refresh its active context without forgetting how heavily context has been used. Algorithm 1 summarizes the full procedure.
Adaptive memory pressure. Although the hard capacity B prevents context overflow, enforcing a fixed fraction of B at each round would be unnecessarily rigid: the active context at some rounds contains information that warrants substantially more detailed retention than at others. MemPrice therefore uses as a long-run occupancy target, allowing temporary increases in context usage when additional memory detail is valuable. A virtual queue tracks accumulated occupancy pressure relative to this target and converts it into a memory price:
where and controls the strength of the pricing feedback: larger makes the allocator respond more aggressively to accumulated occupancy pressure. Occupancy above the target increases , while lighter usage gradually releases this pressure. The resulting memory price is shared across all resident memories: when pressure is low, detailed representations are relatively cheap; as pressure accumulates, retaining extra detail requires correspondingly higher estimated utility.
Algorithm 1 MemPrice: Online Memory Allocation with Adaptive Pricing
Require: Hard capacity , target occupancy ratio , pricing constant , window length
1: Initialize round , pressure , carried context , current-window items
2: while true do
3: for do
4: Observe a new interaction item , add it to at level raw, and form the resident set
5: For each , query the LLM oracle for admissible representations and utility estimates ; record their sizes
6: Set and
7: Select by solving Eq. 3
8: Apply and update
9: if the conversation ends then
10: Archive the current-window interaction history and terminate
11: end if
12:
13: end for
14: Archive the current-window interaction history and perform MEMORYREFRESH to obtain the carried context for the next window; set
15: end while
Price-aware joint allocation. Given the global price , MemPrice selects the capacity-feasible representation assignment that maximizes a price-adjusted retention objective:
The price controls how much detail is worth retaining rather than simply filtering memories by relevance. In particular, can be viewed as a per-token context price: additional detail is retained only when its estimated value justifies its extra footprint. Since all resident memories share the same context budget, their representation choices are coupled: a detailed representation may be worthwhile when competition for context is light, but not when more valuable information is competing for the same space. Therefore, Eq. equation 2 becomes a multiple-choice knapsack problem (MCKP), which jointly selects one admissible representation for each resident memory:
Persistent memory pressure across refreshes. At each refresh boundary, the raw transcript from the current window is added to the persistent archive, and a fixed compression–retrieval pipeline constructs the carried context for the next window. This refresh can reintroduce information that was previously compressed out of the active context, making earlier detail available again when needed. The refreshed context remains subject to the hard capacity B, while the virtual queue and global round index t are carried across the boundary.
4 THEORETICAL ANALYSIS
Our analysis distinguishes two sources of hindsight advantage: access to representations preserved along a different memory trajectory, and the ability to redistribute occupancy across time under a global budget. We first characterize the effect of compression-induced state divergence, then evaluate allocation quality on MemPrice's realized memory-state trajectory. To formalize the first effect, consider an independent-state hindsight comparator: an optimal policy that observes the full T-round interaction prefix and follows its own memory trajectory under the same fixed refresh pipeline. Its allocations are subject to the hard capacity at every round and the cumulative occupancy budget . Let denote its optimal cumulative retention utility, and define
The following proposition establishes a linear worst-case regret lower bound for every capacity-feasible, non-anticipating allocator, even with exact utility estimates.
Proposition 1 (Linear regret under independent-state comparison). Let , , and . For any non-anticipating allocator with for all and integers , there exists a -round instance with exact utility estimates such that
Proposition 1 identifies an information-loss barrier rather than an estimation barrier. Before future relevance is revealed, hard capacity forces the online allocator to discard some candidate detail, whereas hindsight preserves the candidate that will later matter. Importantly, the hindsight policy in the construction uses at most at every round, so the lower bound does not rely on redistributing occupancy across time. To isolate the allocation component, we next introduce a same-state comparator that evaluates hindsight decisions on the realized feasible-state trajectory.
For each round , let denote the feasible allocation set induced by MemPrice's realized memory state. We define the global same-state (GSS) hindsight benchmark over a -round prefix as
The GSS benchmark performs counterfactual reallocation on MemPrice's realized memory states. It retains full hindsight and may redistribute occupancy across the entire prefix, but its alternative choices do not propagate to future states. Thus, GSS regret measures allocation loss conditional on the states reached by MemPrice, rather than the long-term cost of generating those states. The occupancy budget is imposed pathwise on the realized prefix, and Appendix B gives the expectation-feasible counterpart aligned with Eq. 1.
To account for errors in the LLM oracle's retention-utility estimates, we make the following bounded-error assumption.
Assumption 1 (Bounded utility and estimation error). There exist finite constants and such that, for every , almost surely, for all and .
We write for the expected accumulated estimation error. Under a global occupancy budget, hindsight may redistribute memory usage across time. To control this temporal advantage, define the priced frontier
Assumption 2 (Priced-frontier regularity). There exists a deterministic sequence such that, for every , almost surely,
Priced-frontier regularity requires the realized utility–occupancy frontiers to admit an approximately common minimizing price. In particular, whenever the round-wise frontiers share a minimizer, even if the resident memories and optimal allocations vary across rounds. Appendix C gives a sufficient condition allowing dispersion in these minimizing prices. This condition controls the remaining hindsight advantage from reallocating occupancy across time and is not required for hard-capacity feasibility or long-run occupancy control. The following result gives the corresponding same-state allocation and occupancy guarantees.
Table 1: Results for Setting I under matched hard memory budgets. All budget-constrained methods use the same persistent-memory budget, retrieval protocol, and answer model within each backbone block. Best and second-best results among budget-constrained methods are shown in bold and underline, respectively. Full Context is an unconstrained reference and is excluded from ranking.
| Method | LongMemEval-S (B = 16k), QA Acc. (%) | LoCoMo (B = 8k), F1 (%) | |||||||
|---|---|---|---|---|---|---|---|---|---|
| S-Hopn = 156 | M-Hopn = 133 | Temp.n = 133 | K-Upd.n = 78 | Overalln = 500 | S-Hopn = 841 | M-Hopn = 282 | Temp.n = 321 | Overalln = 1444 | |
| GLM-5.3-Flash | |||||||||
| Full Context | 94.9 | 80.5 | 89.5 | 87.2 | 88.4 | 62.5 | 48.8 | 53.3 | 57.8 |
| Recent / FIFO | 43.2 | 24.7 | 29.1 | 39.8 | 34.0 | 35.2 | 23.7 | 27.1 | 31.2 |
| Uniform Allocation | 54.1 | 39.8 | 45.2 | 40.6 | 45.8 | 39.4 | 30.2 | 29.7 | 35.4 |
| Content Salience | 78.6 | 64.3 | 72.8 | 68.9 | 71.7 | 42.8 | 35.9 | 34.7 | 39.7 |
| Dense Salience | 72.3 | 59.4 | 65.1 | 62.7 | 65.5 | 46.6 | 37.8 | 40.5 | 43.5 |
| LRE-SelfSup | 75.2 | 61.7 | 69.8 | 66.4 | 68.8 | 49.9 | 41.3 | 43.0 | 46.7 |
| MemPrice (Ours) | 80.0 | 66.8 | 79.6 | 77.3 | 76.0 | 49.4 | 41.9 | 48.8 | 47.8 |
| DeepSeek-V4.1-Flash | |||||||||
| Full Context | 92.8 | 81.8 | 87.4 | 88.1 | 87.7 | 58.9 | 52.0 | 48.7 | 55.3 |
| Recent / FIFO | 40.5 | 27.1 | 26.8 | 41.2 | 33.4 | 31.9 | 25.2 | 26.6 | 29.4 |
| Uniform Allocation | 52.6 | 44.1 | 42.8 | 42.2 | 46.1 | 37.5 | 28.1 | 31.8 | 34.4 |
| Content Salience | 76.1 | 66.2 | 70.4 | 68.7 | 70.8 | 40.9 | 34.7 | 39.0 | 39.3 |
| Dense Salience | 69.2 | 60.5 | 64.3 | 59.8 | 64.1 | 44.2 | 39.1 | 45.3 | 43.4 |
| LRE-SelfSup | 73.5 | 63.4 | 68.7 | 66.9 | 68.5 | 47.2 | 40.6 | 44.8 | 45.4 |
| MemPrice (Ours) | 77.4 | 73.0 | 73.4 | 75.1 | 74.8 | 47.3 | 45.0 | 44.1 | 46.1 |
| Qwen3.8-Flash | |||||||||
| Full Context | 95.4 | 82.0 | 90.8 | 88.2 | 89.5 | 63.7 | 49.9 | 55.8 | 59.2 |
| Recent / FIFO | 42.4 | 28.3 | 26.1 | 34.5 | 33.1 | 34.8 | 24.7 | 24.5 | 30.5 |
| Uniform Allocation | 55.3 | 38.9 | 49.0 | 50.2 | 48.5 | 38.1 | 29.6 | 33.0 | 35.3 |
| Content Salience | 78.2 | 63.9 | 73.5 | 68.4 | 71.6 | 43.5 | 34.2 | 36.7 | 40.2 |
| Dense Salience | 72.5 | 59.3 | 68.2 | 66.8 | 67.0 | 49.1 | 38.5 | 41.9 | 45.4 |
| LRE-SelfSup | 75.4 | 62.1 | 71.0 | 67.9 | 69.5 | 48.8 | 42.7 | 42.0 | 46.1 |
| MemPrice (Ours) | 80.4 | 67.5 | 80.2 | 72.0 | 75.6 | 48.5 | 43.0 | 48.1 | 47.3 |
Theorem 1 (Same-state allocation and occupancy guarantees). Algorithm 1 maintains at every round by construction. Under Assumptions 1 and 2, for any evaluation prefix ,
Theorem 1 establishes same-state allocation and occupancy guarantees on MemPrice's realized memory-state trajectory. MemPrice never exceeds the hard capacity , whereas acts as a long-run operating target rather than a per-round cap; consequently, the excess average occupancy vanishes at rate . The regret bound decomposes into the online pricing term , the accumulated estimation error , and the priced-frontier deviation . For fixed , yields vanishing average GSS regret, while gives cumulative GSS regret. Larger strengthens occupancy feedback, tightening the occupancy bound at the cost of a larger online pricing term.
5 EXPERIMENTS
5.1 EXPERIMENTAL SETTINGS
Experimental settings. We evaluate memory allocation under two information regimes. Setting I is query-blind: the terminal query is hidden while memory is constructed, and the allocator can use only the chronological history observed so far. We evaluate on LongMemEval-S (Wu et al., 2025) and LoCoMo (Maharana et al., 2024). We compare with query-blind controls including Recent/FIFO, Uniform Allocation, Content Salience, Dense Salience, and LRE-SelfSup (Lia & Mazumder, 2026). Full Context is reported separately as an unbudgeted reference. Setting II is goal-observable: the task goal is visible from reset and may guide allocation, while future observations, tool outputs, and evaluator information remain hidden. We evaluate on AppWorld (Trivedi et al., 2024) and WebShop (Yao et al., 2022), comparing against ReAct/FIFO History (Yao et al., 2023), a Summary Agent, and ZipAct-B, our budget-matched adaptation of ZipAct (Pan et al., 2026). All budgeted methods share the same tokenizer-measured historical-memory capacity, information contract, task split, evaluator, and failure denominator.
Table 2: Results for Setting II in the goal-observable setting at historical-memory tokens. All budget-constrained methods use the same persistent-memory budget, retrieval protocol, and answer model within each backbone block. Reported results are mean SD over three independent seeds.
| Model | Method | AppWorld TGC (%) | WebShop SR (%) | |
|---|---|---|---|---|
| Normal | Challenge | |||
| GLM-5.3-Flash | ReAct / FIFO History | |||
| Summary Agent | ||||
| ZipAct | ||||
| MemPrice (Ours) | ||||
| DeepSeek-V4.1-Flash | ReAct / FIFO History | |||
| Summary Agent | ||||
| ZipAct | ||||
| MemPrice (Ours) | ||||
| Qwen3.8-Flash | ReAct / FIFO History | |||
| Summary Agent | ||||
| ZipAct | ||||
| MemPrice (Ours) | ||||
We repeat the main comparison with GLM-5.3-Flash Zeng et al. (2026), Qwen3.8-Flash Qiu et al. (2026), and DeepSeek-V4.1-Flash Xu et al. (2026). For each model–dataset pair, all methods use the same reader/agent, prompting interface, tokenizer, and decoding configuration. The historical-memory budget B excludes the current query or goal, current observation, system prompt, tool schemas, and output reserve. Our method uses five ordered representations—raw, summary, abstraction, keywords, and delete—and jointly allocates them with an exact multiple-choice knapsack solver. We set the target occupancy to , maintain the persistent pressure state , and trigger maintenance at capacity pressure or after at most L = 10 interactions. The scale c is selected on development data using occupancy only. We report the primary comparison at and average all main results over three random seeds.
5.2 MAIN RESULTS
Setting I: query-blind resource allocation Table 1 shows a consistent advantage of MemPrice under matched memory budgets. Full Context uses the complete history and is reported only as an unconstrained reference; it is excluded from best/second-best ranking. All reported Overall scores are weighted by the corresponding category sizes. On LongMemEval-S, MemPrice improves the strongest constrained baseline across the three backbones and ranks first in every query category. More importantly, the gain is highly non-uniform across query types: improvements are modest on single-hop questions, but become substantially larger on multi-hop, temporal, and knowledge-update queries. This pattern suggests that MemPrice is most useful when memory items compete for capacity over longer dependencies, where simple recency or salience scores are insufficient to capture their future value. LoCoMo exhibits the same trend in a weaker form: MemPrice remains best overall across all backbones, while individual single-hop or temporal subsets can still favor LRE-SelfSup or Dense Salience. This indicates that the benefit comes primarily from difficult allocation decisions rather than uniformly improving retrieval. Finally, MemPrice still trails Full Context, showing that better allocation cannot fully recover information removed by a hard budget; instead, it narrows the performance loss by preserving a more useful subset of the history.
Setting II: goal-observable resource allocation Table 2 shows that MemPrice consistently outperforms all baselines across three backbones and both agent benchmarks, with ZipAct being the strongest competitor in every setting. The improvement is particularly pronounced on WebShop, where MemPrice exceeds ZipAct by 2.7–3.3 points, compared with more moderate gains on AppWorld. This suggests that adaptive memory allocation is especially beneficial for long-horizon interactive tasks, where preserving goal-relevant states and past actions is critical for subsequent decisions. In contrast, the smaller gains on AppWorld Challenge indicate that, as task difficulty increases, failures are increasingly driven by planning and execution rather than memory alone. We also observe that Summary Agent consistently underperforms even FIFO history, suggesting that ag-
Table 3: Ablation study with GLM-5.3-Flash as the backbone. Each variant removes or replaces a single component of the full method while keeping all other components unchanged. FIFO History is included as a non-ablation reference.
| Method | LongMemEval-S QA Acc. (%) | LoCoMo F1 (%) | AppWorld TGC (%) | WebShop SR (%) |
|---|---|---|---|---|
| Ours (Full) | 76.0 | 47.8 | 42.2 | 53.1 |
| Fixed Price | 70.9 | 44.6 | 41.5 | 50.9 |
| Raw/Delete | 34.7 | 32.6 | 36.3 | 45.1 |
| Greedy Allocation | 73.5 | 45.8 | 40.8 | 51.7 |
| Reset Q | 71.6 | 45.2 | 41.7 | 50.5 |
| No Recovery | 74.4 | 44.1 | 41.8 | 50.7 |
| FIFO History | 30.4 | 31.2 | 35.1 | 43.6 |
Table 4: Sensitivity to the target occupancy parameter at . Task columns report each benchmark's primary quality metric; for AppWorld, we report TGC on Test-Normal. Mean occupancy is the normalized historical-memory load averaged across the four benchmarks. The default is .
| α | LongMemEval-S QA Acc. (%) | LoCoMo F1 (%) | AppWorld TGC (%) | WebShop SR (%) | Mean Occupancy |
|---|---|---|---|---|---|
| 0.6 | 73.2 | 45.6 | 40.7 | 51.4 | 0.59 |
| 0.7 | 75.1 | 47.2 | 41.8 | 52.7 | 0.70 |
| 0.8 | 76.0 | 47.8 | 42.2 | 53.1 | 0.79 |
| 0.9 | 75.8 | 48.0 | 42.3 | 53.0 | 0.88 |
gressive summarization can discard fine-grained actionable information that remains important for agent execution. Overall, the consistent gains across backbones indicate that MemPrice improves how a fixed memory budget is allocated rather than relying on a particular underlying model.
5.3 ABLATION STUDY
Table 3 reveals several complementary roles of our design. The largest degradation comes from Raw/Delete, especially on LongMemEval-S and LoCoMo, showing that memory management should not be reduced to deciding what to keep or discard; intermediate-fidelity representations are essential for preserving useful evidence under tight budgets. Fixed Price and Reset Q also hurt more on memory-intensive benchmarks, suggesting that memory pressure is both task-dependent and persistent over time, and therefore benefits from adaptive pricing and a stateful pressure signal. Replacing joint allocation with a greedy rule causes a smaller but consistent loss, indicating that coordination across memory items matters beyond local decisions. Finally, No Recovery remains competitive on AppWorld but degrades more on LoCoMo and WebShop, suggesting that recovery is particularly useful when earlier compression decisions can become important again later in a long interaction. Overall, the ablations support our view that effective memory management requires not only compression, but adaptive and reversible allocation under evolving memory pressure.
5.4 SENSITIVITY ANALYSIS
Table 4 studies the target occupancy parameter , which determines how aggressively the memory allocator frees capacity when memory pressure is encountered. Increasing from 0.6 to 0.8 consistently improves task quality across all four benchmarks. With a small , the allocator leaves substantial unused headroom after compression, which reduces future memory pressure but also removes or downsamples useful historical information too aggressively. Allowing the memory to operate at a higher occupancy preserves more relevant evidence and therefore improves downstream performance. Importantly, also controls a systems-level trade-off between memory utilization and inference cost. A larger allows the model to use a greater fraction of the available context but leaves less free capacity after each compression event. As new observations accumulate, the memory therefore reaches the allocation boundary again sooner or compress tighter, leading to more frequent compression and reallocation operations. These additional memory-management calls increase auxiliary token consumption and can also increase end-to-end inference latency. Conversely, a smaller reduces this overhead by maintaining more headroom but sacrifices task quality through more aggressive compression.
6 CONCLUSIONS
We study long-term agent memory as a resource-allocation problem under limited memory budgets. Rather than treating memory management as only retention, deletion, or compression, we consider how an agent should allocate limited capacity across historical information with different utility and storage costs. We propose a budget-aware framework that combines adaptive memory pricing, multi-fidelity representations, and joint allocation. Experiments on long-context QA and interactive agent benchmarks show that explicitly managing memory pressure leads to more effective and robust use of limited memory. Our work has several limitations. The current framework relies on estimated utility signals and a predefined set of memory operations, and mainly focuses on memory capacity rather than jointly considering computation, retrieval, and latency.
REFERENCES
Shipra Agrawal, Zizhuo Wang, and Yinyu Ye. A dynamic near-optimal algorithm for online linear programming. Operations Research, 62(4):876–890, 2014.
Ruicheng Ao, Jiashuo Jiang, and David Simchi-Levi. Learning to price with resource constraints: From full information to machine-learned prices. Advances in Neural Information Processing Systems, 38:91243–91281, 2026.
Prateek Chhikara, Dev Khant, Saket Aryan, Taranjeet Singh, and Deshraj Yadav. Mem0: Building production-ready ai agents with scalable long-term memory. arXiv preprint arXiv:2504.19413, 2025.
Nikhil R Devanur and Kamal Jain. Online matching with concave returns. In Proceedings of the forty-fourth annual ACM symposium on Theory of computing, pp. 137–144, 2012.
Rodolphe Jenatton, Jim Huang, and Cédric Archambeau. Adaptive algorithms for online convex optimization with long-term constraints. In International Conference on Machine Learning, pp. 402–411. PMLR, 2016.
Jiashuo Jiang and Jiawei Zhang. Online resource allocation with stochastic resource consumption. arXiv preprint arXiv:2012.07933, 2020.
Jiashuo Jiang, Xiaocheng Li, and Jiawei Zhang. Online stochastic optimization with wasserstein-based nonstationarity. Management Science, 71(11):9104–9122, 2025.
Xiaocheng Li and Yinyu Ye. Online linear programming: Dual convergence, new algorithms, and regret bounds. Operations Research, 70(5):2948–2966, 2022.
Nusrat Jahan Lia and Aritra Mazumder. Learning what not to forget: Long-horizon agent memory from a few kilobytes of learning, 2026. URL https://arxiv.org/abs/2606.20954.
Shang Liu, Jiashuo Jiang, and Xiaocheng Li. Non-stationary bandits with knapsacks. Advances in Neural Information Processing Systems, 35:16522–16532, 2022.
Adyasha Maharana, Dong-Ho Lee, Sergey Tulyakov, Mohit Bansal, Francesco Barbieri, and Yuwei Fang. Evaluating very long-term conversational memory of LLM agents. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 13851–13870. Association for Computational Linguistics, 2024. doi: 10.18653/v1/2024.acl-long.747. URL https://aclanthology.org/2024.acl-long.747/.
Charles Packer, Sarah Wooders, Kevin Lin, Vivian Fang, Shishir G. Patil, Ion Stoica, and Joseph E. Gonzalez. Memgpt: Towards llms as operating systems. arXiv preprint arXiv:2310.08560, 2023.
Zhiming Pan, Junyu Luo, Zhiping Xiao, Kaize Ding, Xiao Luo, and Ming Zhang. Zipact: Zipping interaction history into a compact state for efficient LLM agents. Transactions on Machine Learning Research, 2026. ISSN 2835-8856. URL https://openreview.net/forum?id=ZssIalqqrz.
Joon Sung Park, Joseph C. O'Brien, Carrie J. Cai, Meredith Ringel Morris, Percy Liang, and Michael S. Bernstein. Generative agents: Interactive simulacra of human behavior. In Proceedings of the 36th Annual ACM Symposium on User Interface Software and Technology, 2023. doi:10.1145/3586183.3606763.
Zihan Qiu, Zekun Wang, Xiao Li, Yanpeng Li, Yang Xu, Yixuan Wang, Huaqing Zhang, Rui Men, Bochao Mao, Chengruidong Zhang, et al. On the design of qwen3. 8-next architecture: Evaluation, efficiency, and training stability. arXiv preprint arXiv:2608.30320, 2026.
Noah Shinn, Federico Cassano, Ashwin Gopinath, Karthik Narasimhan, and Shunyu Yao. Reflexion: Language agents with verbal reinforcement learning. In Advances in Neural Information Processing Systems, volume 36, 2023.
Weiwei Sun, Miao Lu, Zhan Ling, Kang Liu, Xuesong Yao, Yiming Yang, and Jiecao Chen. Scaling long-horizon llm agent via context-folding. arXiv preprint arXiv:2510.11967, 2025.
Harsh Trivedi, Tushar Khot, Mareike Hartmann, Ruskin Manku, Vinty Dong, Edward Li, Shashank Gupta, Ashish Sabharwal, and Niranjan Balasubramanian. AppWorld: A controllable world of apps and people for benchmarking interactive coding agents. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 16022–16076. Association for Computational Linguistics, 2024. doi: 10.18653/v1/2024.acl-long.850. URL https://aclanthology.org/2024.acl-long.850/.
Lei Wei, Xiao Peng, Tt, Guannan Zhang, Chenhao Jiang, Hongyu Li, Lanbo Lin, Yuanwu Xu, Jiayao Liu, Kesu Wang, and Bin Wang. PACE: Predictive adaptive context extraction for long-horizon LLM agents. In Maria Liakata, Viviane P. Moreira, Jiajun Zhang, and David Jurgens (eds.), Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 27184–27199, San Diego, California, United States, July 2026. Association for Computational Linguistics. ISBN 979-8-89176-390-6. doi: 10.18653/v1/2026.acl-long.1252. URL https://aclanthology.org/2026.acl-long.1252/.
Di Wu, Hongwei Wang, Wenhao Yu, Yuwei Zhang, Kai-Wei Chang, and Dong Yu. LongMemEval: Benchmarking chat assistants on long-term interactive memory. In International Conference on Learning Representations, 2025. URL https://proceedings.iclr.cc/paper_files/paper/2025/hash/d813d324dbf0598bbdc9c8e79740ed01-Abstract-Conference.html.
Anyi Xu, B Li, Bangcai Lin, Bing Xue, BingCheng Xian, Bingzheng Xu, Bochao Wu, Bowei Zhang, Boyi Deng, CC Yu, et al. Deepseek-v4. 1-flash: Pushing the limits of kv cache compression. arXiv preprint arXiv:2609.19969, 2026.
Wujiang Xu, Zujie Liang, Kai Mei, Hang Gao, Juntao Tan, and Yongfeng Zhang. A-mem: Agentic memory for llm agents. In Advances in Neural Information Processing Systems, volume 38, 2025. doi: 10.52202/085713-0593.
Shunyu Yao, Howard Chen, John Yang, and Karthik R Narasimhan. Webshop: Towards scalable real-world web interaction with grounded language agents. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho (eds.), Advances in Neural Information Processing Systems, 2022. URL https://openreview.net/forum?id=R9KnuFlvnU.
Shunyu Yao, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik R. Narasimhan, and Yuan Cao. ReAct: Synergizing reasoning and acting in language models. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id=WE_vluYUL-X.
Rui Ye, Zhongwang Zhang, Kuan Li, Huifeng Yin, Zhengwei Tao, Yida Zhao, Liangcai Su, Liwen Zhang, Wenbiao Yin, Zile Qiao, Xinyu Wang, Pengjun Xie, Fei Huang, Jingren Zhou, Siheng Chen, and Yong Jiang. Agentfold: Long-horizon web agents with proactive context folding. In International Conference on Learning Representations, 2026.
Hao Yu, Michael Neely, and Xiaohan Wei. Online convex optimization with stochastic constraints. In Advances in Neural Information Processing Systems, volume 30, 2017.
Aohan Zeng, Xin Lv, Zhenyu Hou, Zhengxiao Du, Qinkai Zheng, Bin Chen, Da Yin, Chendi Ge, Chenghua Huang, Chengxing Xie, et al. Glm-5: from vibe coding to agentic engineering. arXiv preprint arXiv:2602.15763, 2026.
Wanjun Zhong, Lianghong Guo, Qiqi Gao, He Ye, and Yanlin Wang. Memorybank: Enhancing large language models with long-term memory. arXiv preprint arXiv:2305.10250, 2023.
Yiming Zong and Jiashuo Jiang. Online semi-infinite linear programming: Efficient algorithms via function approximation. arXiv preprint arXiv:2603.16200, 2026.
A RELATED WORKS
Agent memory and long-horizon context management. A growing body of work equips language agents with persistent memory beyond the model's immediate context window. Reflexion stores linguistic feedback from previous trials in an episodic memory buffer to improve subsequent decisions (Shinn et al., 2023), while Generative Agents maintain a stream of experiences and retrieve memories according to factors such as relevance, recency, and importance, together with higher-level reflection (Park et al., 2023). MemoryBank further introduces selective reinforcement and forgetting for long-term conversational memory (Zhong et al., 2023). Other systems emphasize memory architecture and organization. MemGPT manages information across hierarchical memory tiers through an operating-system-inspired virtual context mechanism (Packer et al., 2023); Mem0 dynamically extracts, consolidates, and retrieves salient conversational information (Chhikara et al., 2025); and A-MEM organizes memories into an evolving network whose representations and associations can change as new experiences arrive (Xu et al., 2025). These approaches substantially extend the temporal reach of LLM agents, but primarily focus on how memories are stored, organized, updated, or retrieved. In contrast, our work isolates a complementary question: given the information currently available to an agent, how should scarce active-context capacity be allocated among competing memories and representation levels?
Adaptive context selection and compression. Recent work has moved beyond static memory retrieval toward actively controlling the contents and granularity of an agent's working context. Context-Folding allows an agent to branch into temporary sub-trajectories and subsequently fold intermediate reasoning into compact summaries, thereby preventing context growth on long-horizon tasks (Sun et al., 2025). AgentFold similarly treats the context as a dynamic workspace and learns proactive folding operations at different granularities, explicitly addressing the tension between unbounded raw trajectories and irreversible information loss from fixed summarization (Ye et al., 2026). Most closely related to our setting, PACE formulates context construction as a Next Step Prediction problem and adjusts the representation granularity of historical information according to its predicted relevance for the agent's upcoming action (Wei et al., 2026). These methods demonstrate the importance of selectively preserving detail rather than applying uniform truncation or summarization. Our perspective is complementary: rather than primarily predicting which history will be useful next or learning when to fold a trajectory, we explicitly model active context as a shared resource. Memory items with heterogeneous retention value and footprint compete for this resource, and allocation jointly determines both which items remain active and the granularity at which they are represented. This makes the opportunity cost of memory occupancy explicit and enables conversation-level resource control rather than treating context pressure only as a local selection or compression signal.
Online Resource Allocation and Long-Term Constraints. Online resource allocation can be viewed as sequential optimization under intertemporal constraints, where current decisions affect both immediate rewards and future resource availability. A classical approach is to associate resource constraints with dual prices that quantify the marginal value of capacity (Devanur & Jain, 2012). These prices can be updated dynamically as information accumulates (Agrawal et al., 2014; Li & Ye, 2022), and related models have been studied under stochastic resource consumption (Jiang & Zhang, 2020) and non-stationary input distributions (Jiang et al., 2025). Such constrained allocation problems are closely connected to online optimization with long-term constraints, where primal-dual mechanisms balance objective performance and cumulative feasibility. This perspective has been studied in OCO through regret and constraint-violation guarantees (Jenatton et al., 2016;
Yu et al., 2017; Ao et al., 2026; Zong & Jiang, 2026), and also arises in resource-constrained learning problems such as bandits with knapsacks (Liu et al., 2022).
B EXPECTATION-FEASIBLE GLOBAL SAME-STATE BENCHMARK
The main text evaluates MemPrice against a global same-state comparator whose occupancy budget is enforced on each realized evaluation prefix. Here we consider a more permissive expectation-feasible counterpart that matches the average-occupancy constraint in Eq. 1. Let denote a realization of all randomness in the interaction and in MemPrice, including any randomness in the oracle and refresh pipeline. For each round and realization , let
denote the feasible allocation set induced by MemPrice's realized memory state. The memory-state trajectory is fixed to that generated by MemPrice: choices made by the hindsight comparator are evaluated counterfactually and do not alter the feasible sets at later rounds.
Let denote an auxiliary random seed independent of the randomness generating MemPrice's trajectory. A randomized same-state hindsight selector observes the complete realized prefix and selects
Expectations below are taken jointly over and . Thus, may use full hindsight when choosing each , but it cannot recover representations that were unavailable on MemPrice's realized trajectory or induce a different future memory state. Let denote the set of all such measurable selectors. We call a selector expectation-feasible if
The per-round feasible-set constraint holds pathwise, whereas the cumulative occupancy budget in Eq. equation 8 is imposed only in expectation. Hence, the comparator may use more than total normalized occupancy on some realizations and less on others, while remaining within the hard capacity at every round.
Define
The expectation-feasible global same-state hindsight value and its associated regret are
and
We refer to this comparator as EGSS. Every pathwise-feasible same-state selector is expectation-feasible, so this comparator is at least as permissive as the benchmark in the main text.
Since the cumulative occupancy constraint is imposed only in expectation, the corresponding dual comparison requires a deterministic shadow price shared across realizations.
Assumption 3 (Expected priced-frontier regularity). For every , there exists a deterministic such that
where is deterministic.
Theorem 2 (Expectation-level global guarantee). Under Assumptions 1 and 3, for any evaluation prefix ,
Moreover, MemPrice satisfies
Theorem 2 shows that the main guarantees extend to the more permissive expectation-feasible comparator aligned with Eq. equation 1. If , the average EGSS regret vanishes; if both terms are , the cumulative regret remains . Moreover, the excess expected average occupancy above vanishes as .
Importantly, this extension relaxes only how the long-run occupancy budget is enforced. The comparator remains same-state: it may redistribute context usage across time and stochastic realizations, but cannot undo MemPrice’s earlier compression decisions or follow an independent memory trajectory.
C A SUFFICIENT CONDITION FOR PRICED-FRONTIER REGULARITY
We give a simple sufficient condition for Assumption 2 in terms of the dispersion of the round-wise optimal shadow prices.
For each round t, define
The set is nonempty and contained in . Indeed, the all-delete action gives , while . Moreover, since , the function is 1-Lipschitz in . Therefore, for any ,
where
Consequently, Assumption 2 holds whenever there exists a deterministic sequence such that, almost surely,
A more concrete sufficient condition is obtained when, for each prefix , there exists a common price such that all but rounds satisfy
Then
and hence Assumption 2 follows. Thus, priced-frontier regularity permits a sublinear number of atypical rounds while requiring the optimal memory shadow prices on the remaining rounds to concentrate around a common value.
D PROOF OF PROPOSITION 1
Fix and , and write
Let be integers, and fix any possibly randomized, non-anticipating allocator satisfying at every round. The fixed, non-anticipating refresh pipeline is the same for the online allocator and the hindsight comparator. Partition the -round prefix into windows of lengths , with for , , and . We construct a family of instances , where identifies the candidate that becomes relevant in window . We choose exogenous arrivals, so allocation decisions change memory states but not the subsequent interaction sequence. All raw candidate records and all auxiliary arrivals other than the target-revelation signals are fixed independently of . A window's target affects the interaction only through its revelation and the subsequent utility profiles in that window.
A common prefix in each window. In the first rounds of window , one new candidate arrives per round. Candidates have distinct identities across windows, and their raw contents are absent from earlier transcripts. Throughout its arrival window, each candidate has raw size ; all non-raw representations have zero size and utility. This is a special case of the five-level representation model and satisfies its monotonicity requirements.
All candidates have zero utility through local round . If , the interaction reveals at round without reproducing the candidate's raw contents. Its raw representation then has utility one until the window ends, while all other representations have utility zero. Carried history and items from earlier windows have zero utility throughout the current window. Other arrivals have zero utility and never reproduce a raw candidate. The oracle is exact, and for every feasible allocation on either policy's memory trajectory.
The arrivals and oracle profiles in the first rounds do not depend on . Thus the allocator receives no information about the target before its revelation. Allocation within a window only selects representation levels for existing resident items; it does not introduce new copies of discarded candidates. Together with the irreversible representation constraint and the absence of within-window archive access, this prevents recovery of a lost raw representation before the window ends. The allocator may carry its full internal state across boundaries; no reset is imposed in the construction.
Feasibility and value of the hindsight benchmark. In each window with , the hindsight policy deletes all carried and non-target items and retains candidate in raw form from its arrival until the window ends. In a window with , it deletes all items. Its post-allocation occupancy satisfies
This policy uses the same fixed refresh pipeline: the returned context is deleted at the next allocation.
The policy earns in window . No policy can earn more, since each round after the first has utility at most one and all earlier rounds have utility zero. Writing for the independent-state hindsight optimum, we obtain
This value holds for every realization of the boundary pipeline.
Online utility under fresh uncertainty. For the averaging argument, draw independently and uniformly from . Let be an exogenous random tape driving the allocator and the fixed boundary pipeline, sampled independently of . Conditional on , their responses are deterministic functions of the information available to them.
Consider a window with . Let be the set of its candidates retained in raw form immediately after the local round-M allocation. Since , hard feasibility gives . By non-anticipation and the common observable prefix, is determined by and does not depend on . Hence
The allocator earns positive utility after local round only if , and even then earns at most . Therefore,
The same inequality holds trivially when . Summing over windows yields
A fixed hard instance over the full interaction. For a fixed target vector , define
Combining the preceding inequality with equation 13 gives
Consequently, there exists a fixed vector such that, on ,
The vector may depend on the allocator and T, but not on the realized random seed.
A linear bound in the interaction length. Write , where and . Then
Since ,
Substituting into equation 14 gives
which proves equation 4. For fixed , is constant; in particular, for ,
Thus the worst-case expected regret is .
E PROOF OF THEOREM 1
Fix an evaluation prefix and work on the probability-one event on which Assumptions 1 and 2 hold up to . Set . Since and , we have .
Hard-capacity feasibility. Along MemPrice's realized trajectory, , and Algorithm 1 selects at every round. Hence
Thus hard-capacity feasibility holds for every execution.
Global same-state comparison. Recall the priced frontier
For any and any feasible sequence in the global same-state benchmark,
where the inequality uses . For the fixed prefix , let be a common price satisfying Assumption 2, and it holds that
At round t, exact maximization of the estimated priced objective and Assumption 1 imply
Indeed, the additive term is independent of the action, and the definition of implies that replacing estimated utilities by true utilities loses at most .
Combining equation 15 and equation 16 gives, pathwise,
(17)
where the second inequality follows from and Assumption 2.
Global queue drift. The queue recursion gives
Using and ,
Since is nonincreasing and ,
Therefore,
Combining equation 17 and equation 18 yields
Taking expectations and using gives
Controlling occupancy through the all-delete action. Let denote the all-delete allocation. It is feasible and satisfies
Exact maximization of the estimated priced objective gives
Assumption 1 therefore implies
Set
The sequence is nondecreasing. Whenever ,
and hence
Thus whenever .
We claim that
For t = 1,
Suppose and . If , then
If , then
This proves equation 20, and in particular
Cumulative occupancy violation. Since ,
Summing from t = 1 to T and using gives
Since ,
Therefore, by equation 21,
almost surely. This proves all claims of Theorem 1.
F PROOF OF THEOREM 2
Fix an evaluation prefix , and write
Expectation-feasible hindsight comparison. Let be any expectation-feasible same-state hindsight selector. By definition,
for every round almost surely, and
For the deterministic price in Assumption 3,
The last inequality uses , expectation feasibility, and almost surely. Taking the supremum over therefore gives
Online frontier comparison. At each round, MemPrice exactly maximizes
over . Under Assumption 1, the same argument as in the proof of Theorem 1 gives, almost surely,
a.s.
(23)
Equivalently,
Summing over , taking expectations, and using yields
Combining Eqs. equation 22 and equation 24,
Since
Assumption 3 implies
Queue drift. The queue recursion
implies, pathwise,
Since , , and ,
Because is nonincreasing and ,
Hence, almost surely,
Taking expectations preserves the bound:
Combining Eqs. equation 25, equation 26, and equation 27 gives
which proves Eq. equation 11.
Expected average occupancy. It remains to establish Eq. equation 12. As in the proof of Theorem 1, comparison with the all-delete allocation and Assumption 1 give
Let
Whenever ,
and therefore
Thus whenever . The same induction as in Theorem 1 gives
a.s.
Moreover, since
summing over t gives
Hence, almost surely,
Taking expectations yields
which proves Eq. equation 12.
G IMPLEMENTATION DETAILS
G.1 DETAILED EXPERIMENTAL SETTINGS
Information regimes. Our experiments distinguish two memory-allocation regimes according to when the downstream information need becomes observable. In Setting I, memory is constructed without access to the terminal query. For a chronological history H, the allocator produces a bounded memory state before the target question is released. Target questions, answers, evidence annotations, question types, and evaluation feedback are therefore unavailable to both the allocator and its utility estimator during memory construction. This setting evaluates whether a memory policy can preserve information that is useful for unknown future requests. In Setting II, the task goal is available from reset and may be used to determine which parts of the interaction history should be retained. Future observations, tool outputs, environment states, and evaluator-only information remain unavailable. This setting corresponds to long-horizon agents that know what they are trying to accomplish but must manage an increasing trajectory online.
LongMemEval-S. LongMemEval (Wu et al., 2025) evaluates long-term interactive memory over histories containing multiple temporally separated sessions. We use the LongMemEval-S variant as a primary query-blind benchmark. For each history, the complete chronological interaction stream is processed before its associated evaluation questions are released. All questions attached to the same history therefore reuse the same frozen terminal memory state rather than reconstructing memory separately for each question. This prevents the allocator from specializing memory to individual queries. We report the benchmark's official QA accuracy as the primary metric. The larger LongMemEval-M variant is reserved for long-context stress analysis rather than the primary comparison.
LoCoMo. LoCoMo (Maharana et al., 2024) evaluates very long-term conversational memory across extended multi-session dialogues. Its questions cover several forms of retrieval and reasoning, including single-hop factual recall, temporal reasoning, multi-hop questions, and cases requiring information to be integrated across distant portions of a conversation. We expose only the chronological conversation while memory is constructed; evaluation questions and their annotations are revealed after the memory state has been frozen. The complete conversation is treated as the evaluation unit, and all methods receive identical session segmentation and memory budgets. We use normalized partial-match F1 as the primary evaluation metric.
AppWorld. AppWorld (Trivedi et al., 2024) is a stateful interactive benchmark in which an agent operates a collection of applications through structured APIs to satisfy a natural-language goal. Unlike Setting-I benchmarks, the goal is visible before the first action, so memory policies may condition retention decisions on task relevance. The agent does not observe future tool results, future application state, or the benchmark evaluator. Each completed action together with its resulting observation forms a historical interaction unit for memory management. We evaluate separately on the official Test-Normal and Test-Challenge splits. The primary metric is Task Goal Completion (TGC), for which a task is successful only when its benchmark-native state-based tests are satisfied. Scenario Goal Completion and difficulty-based breakdowns are retained as secondary analyses.
WebShop. WebShop (Yao et al., 2022) provides a reproducible simulated e-commerce environment in which an agent must search, inspect, and select products satisfying a user-specified shopping goal. The complete goal is available from reset, while future search results, product pages, and environment transitions are revealed only through the agent's own actions. WebShop therefore provides a second goal-observable setting with a different interaction structure from AppWorld. Historical search and browsing observations are subject to the same bounded memory interface as other Setting-II tasks. We report Success Rate, the fraction of tasks receiving the maximum terminal reward, as the primary metric and average terminal reward as a secondary metric.
Setting-I baselines. All Setting-I competitors obey the same query-blind information contract and hard historical-memory budget. Recent/FIFO retains history in reverse chronological order until the budget is exhausted and provides a pure recency control (cf. Park et al., 2023). Uniform Allocation uses the same candidate representation levels as our method but distributes resources uniformly.
across memory items, isolating the effect of adaptive allocation. Content Salience ranks memory using query-independent lexical salience, while Dense Salience uses a dense semantic representation; both retain the highest-valued content under the common capacity. LRE-SelfSup (Lia & Mazumder, 2026) learns to predict the future usefulness of history units without observing the future query. Full Context is reported separately as an unbudgeted upper-reference condition and is not included in matched-resource comparisons.
Setting-II baselines. ReAct/FIFO History (Yao et al., 2023) uses the standard iterative reasoning-and-action interface while retaining the most recent complete trajectory items under budget. Summary Agent periodically compresses accumulated trajectory history into a global summary, providing a conventional long-horizon context compression control. ZipAct-B is our resource-matched adaptation of ZipAct (Pan et al., 2026). It preserves ZipAct's recurrent Goal–World–Constraint state update but requires the state visible to the actor to satisfy the same tokenizer-measured hard historical-memory budget B before every action. Thus, differences in task performance cannot be attributed simply to one method receiving a larger actor-visible context.
Historical-memory budget. The resource budget B applies only to historical information made visible to the reader or agent at a decision point. The current query or task goal, current observation, system instructions, tool schemas, and reserved output tokens are handled separately when enforcing the physical context-window constraint. Dataset-specific budget grids are determined without using test outcomes from development-history length statistics and available physical-context headroom. We use four budget levels derived from the corresponding maximum feasible budget , and report the primary single-budget comparison at . All methods within a dataset use exactly the same budget values.
Multi-fidelity allocation. Each memory item is represented by five ordered fidelity levels: raw, summary, abstraction, keywords, and delete. Candidate representations are generated only from the currently available text and cannot restore information already removed from an active representation. Successive compressed representations target 0.6 of their parent length. Given candidate utilities and tokenizer-measured sizes, our method jointly selects one representation per item through an exact multiple-choice knapsack problem subject to the hard capacity B.
The utility estimator obeys the information contract of its setting. For Setting I it evaluates general-purpose future retention utility without access to the terminal query, whereas in Setting II it may condition utility on the task goal already visible to the agent. Utility scores are constrained to , delete has zero utility, and candidate utilities are monotonically repaired across decreasing fidelity levels when necessary.
Adaptive pricing and memory maintenance. We target average normalized occupancy and maintain a persistent pressure state
where denotes the selected historical-memory size. The corresponding adaptive price is
Both and the global time index persist across memory-maintenance boundaries. The scale c is chosen separately for the two information regimes using development data only, minimizing the deviation between mean occupancy and the target ; downstream task accuracy is never used for this calibration.
Allocation is updated as new memory items are admitted. A maintenance boundary occurs when either active memory reaches capacity or the number of interactions since the previous boundary reaches L = 10. At a boundary, complete raw history is first copied to an append-only external archive, the active memory is compressed, and relevant archived chunks may then be recovered into the next active context. The archive is persistent storage and does not itself count toward the reader-visible budget B; any retrieved text does. Recovery uses BM25 with , , and top-8 retrieval, subject again to the hard active-memory capacity.
Replication. Every main configuration is evaluated with three shared random seeds, namely 2026, 2027, and 2028. The same seed set is used for all competing policies on a given benchmark so that stochastic variation is paired across methods. Language-model decoding itself remains deterministic where supported. We report the mean across the three runs together with dispersion in the corresponding result tables.