ContextPipe: Database-Inspired Context Assembly for Long-Horizon Agents
On the map: LLM agents and tool use → Agent memory systems
Abstract (arXiv)
Long-horizon large language model (LLM) agents require context assembly: the runtime must decide what to include in each prompt, in what order, and when to compact history under a hard context-window budget and a byte-sensitive prompt cache. In production agentic systems, this logic is scattered across prompt builders, ad hoc compaction routines, cache-break workarounds, and per-provider shims. We argue that context assembly is structurally isomorphic to query execution in a relational database: both execute under a hard budget, exploit a tiered cache, and leverage statistics. We adopt this discipline in ContextPipe: a five-phase pipeline (Plan Bind Optimize Execute Feedback) backed by a structured data-source catalog, a deterministic cache-aware optimizer, and an EXPLAIN ANALYZE trace. We show that context in ContextPipe is auditable, replayable, and failure-isolated. A preliminary evaluation using the SWE-bench Pro Qutebrowser subset shows that, compared with the append-only context construction policy, ContextPipe reduces total token volume by 31%, LLM calls by 23%, and response time by 9%, at the cost of a lower KV cache-hit ratio.
Key facts. No citing papers in the map yet (data through 13 Oct 2026). Placed in Agent memory systems, one of 16 directions in LLM agents and tool use. Builds on 21 of its 31 references that are in the map. First posted on arXiv 1 Sep 2026.
Builds on
21 of 31 references.
Closest ancestors · 1
Same direction, newest first
Other references · 20
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,221
- 2023Reflexion: Language Agents with Verbal Reinforcement Learningcited by 4,156
- 2023Toolformer: Language Models Can Teach Themselves to Use Toolscited by 4,117
- 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,637
- 2023Lost in the Middle: How Language Models Use Long Contextscited by 3,412
- 2020Longformer: The Long-Document Transformercited by 3,393
- 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,274
- 2020REALM: Retrieval-Augmented Language Model Pre-Trainingcited by 2,131
- 2023AutoGen: Enabling Next-Gen LLM Applications via Multi-Agent Conversationcited by 1,945
- 2023Self-RAG: Learning to Retrieve, Generate, and Critique through Self-Reflectioncited by 1,815
- 2023MemGPT: Towards LLMs as Operating Systemscited by 1,354
- 2023AgentBench: Evaluating LLMs as Agentscited by 1,242
8 more
- 2023SGLang: Efficient Execution of Structured Language Model Programscited by 1,117
- 2026DeepSeek-V4: Towards Highly Efficient Million-Token Context Intelligencecited by 961
- 2023Large Language Modelscited by 776
- 2023Language Agent Tree Search Unifies Reasoning Acting and Planning in Language Modelscited by 560
- 2022Precise Zero-Shot Dense Retrieval without Relevance Labelscited by 510
- 2025GEPA: Reflective Prompt Evolution Can Outperform Reinforcement Learningcited by 489
- 2025SWE-Bench Pro: Can AI Agents Solve Long-Horizon Software Engineering Tasks?cited by 263
- 2026Optimizing Prompts for Large Language Models: A Causal Approachcited by 3
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2026TokenPilot: Cache-Efficient Context Management for LLM Agents
- 2026Beyond Compaction: Structured Context Eviction for Long-Horizon Agents
- 2025A Survey of Context Engineering for Large Language Models
- 2026Efficient LLM Serving for Agentic Workflows: A Data Systems Perspective
- 2026ContextWeaver: Selective and Dependency-Structured Memory Construction for LLM Agents
- 2025Agentic Context Engineering: Evolving Contexts for Self-Improving Language Models
- 2025ContextPilot: Fast Long-Context Inference via Context Reuse
- 2026ContextPilot: Teaching Agents for Proactive Context Management via Fine-grained RL