TL;DR
MESA (Multi-structure Evidence Selection for long-horizon Agents) is a novel framework that dynamically selects and fuses a query-adaptive subset of diverse memory structures (such as text summaries, knowledge graphs, and raw traces) to answer questions about long agent trajectories. By optimizing this selection policy using sparse, answer-level feedback, MESA outperforms the strongest baselines by up to 8.5% on AMA-Bench while reducing evidence token costs by 41%.
What Problem Does This Paper Address?
As AI agents tackle increasingly complex, long-horizon tasks—like software engineering or multi-step web navigation—they accumulate massive execution histories containing interleaved reasoning, tool outputs, and observations. Finding a critical piece of evidence buried thousands of steps back is a major challenge.
While modern Large Language Models (LLMs) boast massive context windows, feeding them raw, full trajectories is financially expensive and frequently suffers from "lost-in-the-middle" retrieval degradation. To mitigate this, external agent memory systems organize history into specific abstractions (e.g., vector databases, text summaries, or knowledge graphs).
However, each memory structure provides an incomplete view. Summaries lack exact details; vector databases discard temporal order; knowledge graphs miss step-level indexing. Existing systems either use a fixed, exhaustive combination of all structures (which introduces distracting noise and inflates token costs) or route the query to a single structure (preventing the composition of complementary evidence).
Methods
MESA introduces structure-level dynamic selection, an executable policy that determines exactly which combination of memory structures to consult for a given query.
The framework maintains five independent memory structures built offline from the agent's history:
- Text Summary (S): Broad episodic context highlighting major state changes.
- Temporal Store (T): A turn-indexed key-value store preserving chronological sequence.
- Knowledge Graph (G): Relational facts capturing cross-step entity connections.
- Vector Database (V): Dense, step-level embeddings for semantic similarity.
- Raw Episodic Trace (R): Overlapping windows of exact surface-form text.
To learn an effective selection policy ($\rho$) under weak supervision (where ground-truth memory subsets are unavailable and only final answer correctness is known), MESA utilizes Prior-Guided Harness Optimization. Instead of searching an unconstrained space, an LLM proposer generates candidate policies guided by 20 structured prior directions across 5 axes (e.g., demand inference, backend value estimation, and cost shaping). To balance exploration and exploitation among these directions, MESA implements an Upper Confidence Bound (UCB)-guided scheduler. Candidate policies are optimized and selected using a regularized validation objective that explicitly penalizes excessive token usage.
Datasets
The authors evaluate MESA on two primary benchmarks:
- AMA-Bench: A long-horizon agent memory benchmark containing 208 real-world agent episodes and 2,496 expert-curated QA pairs. It spans six domains (Web, Open-World QA, Text-to-SQL, Software Engineering, Gaming, and Embodied AI) and tests four distinct memory capabilities (Recall, Causal Inference, State Updating, and State Abstraction).
- LoCoMo: A long-term conversational memory dataset consisting of 10 multi-session conversations and 1,540 evaluated questions, used to test MESA's generalizability beyond agent trajectories.
Key Insights and Ideas
- The "Goldilocks" Memory Subset: Through an exhaustive sweep of all 31 possible non-empty memory structure combinations, the authors discovered that intermediate subsets (combinations of 2 to 4 structures) consistently outperform both single-structure routing and all-structure fusion.
- No Universal Configuration: The optimal memory configuration is highly task- and domain-dependent. For instance, gaming tasks might rely heavily on temporal stores, while software engineering requires a blend of summaries, raw text, and vector databases to resolve exact code identifiers.
- Interpretable Policy Evolution: As optimization progresses, MESA's learned policy evolves from simple keyword-matching rules into nuanced, query-conditioned routing logic that balances evidence coverage against token budgets.
Key Results
- State-of-the-Art Accuracy: Using a Qwen3-32B backbone, MESA achieves 65.1% overall accuracy on AMA-Bench, outperforming the strongest baseline (AMA-Agent) by 8.5% and a standard long-context reader by 12.5%. Similar gains (+6.4%) were achieved using a Gemma-4-31B backbone.
- Significant Token Savings: MESA achieves its superior accuracy while consuming 41% fewer evidence tokens than the all-structure alternative, successfully navigating the utility-redundancy dilemma.
- Conversational Generalization: On the LoCoMo dataset, MESA achieves an overall F1 score of 49.0%, outperforming the best specialized conversational memory baseline by 1.8%.
Limitations and Future Work
While MESA marks a substantial advancement, the authors note several limitations:
- Decoupled Construction and Selection: Memory structures are constructed statically offline. Jointly optimizing memory construction alongside the selection policy could yield further improvements.
- Causal Inference Bottleneck: MESA showed a slight performance drop (-1.4%) compared to AMA-Agent on explicit Causal Inference tasks, indicating a need for explicit modeling of cross-event and cross-structure dependencies.
- Static Memory Constraints: The current framework does not address continuously updated or multimodal agent memories, which represent vital directions for future research.
Summary updated