Agentic Context Engineering (ACE) in RAG pipelines: How can an AI system improve itself autonomously during its operation?
Executive Summary: A well-maintained and curated knowledge base is essential for the successful deployment of AI agents. But how can agent-based AI systems improve autonomously during operation? This question was at the heart of our joint project with the Technical University of Munich (TUM) on “Agentic Context Engineering (ACE) in RAG Pipelines”. The results demonstrate that ACE provides a methodological framework for integrating and controlling learning processes within AI systems. In the long term, this represents an important step towards continuously learning AI assistants whose development remains transparent and traceable for insurers, particularly in the context of regulatory requirements.
Agentic Context Engineering (ACE) in RAG pipelines: How can an AI system improve itself autonomously during its operation?
Increasingly more companies are putting AI agents into productive use, where these agents are planning and executing multi-stage action chains independently. A well-maintained and curated knowledge base is essential for the successful deployment of such AI agents. But how can AI agents expand their knowledge whilst in operation and learn from new experiences?
With msg.ask:it, we have developed a successful agent-based knowledge platform that delivers high-quality, reliable information and provides convenient access to technical documentation, regulatory frameworks and internal knowledge sources within the insurance industry. To create lasting value within organizations an agent-based AI system such as msg.ask:it needs to be able to develop and improve whilst in use. Large language models are impressively powerful, but static in operational use. While common methods such as manual prompt engineering, Retrieval Augmented Generation (RAG) and agent-based systems address important aspects of this problem, they do not ensure that AI systems learn autonomously.
Joint project with the Technical University of Munich: ACE in a RAG pipeline
How can an AI system learn from its own errors during run time, without the need to retrain the model or to manually adjust the prompt? This was the central question explored in the joint project between msg life and the Munich Data Science Institute (MDSI) at the Technical University of Munich. As part of the TUM Data Innovation Lab, students prototyped the Agentic Context Engineering (ACE) method within a RAG pipeline. ACE does not optimise the model weights, but focuses on the total context within the model or agent operates. Strategies, common errors and valuable solutions are recorded in a language-based playbook – akin to a set of instructions – and developed step by step.
Agentic Context Engineering replaces rigid prompting with a learning, language-based playbook.
ACE is not based on static system prompts, but uses a self-learning playbook[1] . In this playbook, proven strategies are continuously collected and refined, thereby sustainably expanding existing domain knowledge. At the same time, this approach systematically processes human and machine feedback to avoid recurring errors and achieve continuous improvement:
- The playbook grows over time with every task processed.
- It is human-readable and therefore transparent.
- It identifies points where agents regularly fail.
To achieve this, the ACE framework utilises three specialised agents:
- A generator solves tasks using the playbook, which is initially empty, and in doing so generates detailed processing paths and reasoning trajectories that make decisions and results traceable.
- A Reflector analyses the result and any feedback signals, together with the reasoning trajectories, to identify successful strategies and recurring errors.
- A Curator translates these insights into concise updates, ensuring that the newly acquired knowledge is incorporated into the Playbook in a sustainable and structured manner.
The result is a learning context through which the AI system can gradually improve itself.
Experimental setup: A comparison of three variants
The students applied this methodology to a specific dataset containing question-answer pairs. The agent must use a RAG pipeline to answer the questions given based on various Wikipedia articles. The agent is given access to various search tools to search through the articles and must decide for itself when and how often to use which search strategy. The questions in the dataset are deliberately designed to require complex reasoning on the sideof the agent, such that a simple single search is insufficient (so-called ‘multi-hop reasoning’)[2] .
To investigate how ACE can improve the handling of such complex retrieval tasks, three variants were compared:
- Static retrieval: a fixed, integrated search step that is carried out statically before every query.
- Agent-based retrieval: an agent that dynamically decides which search tools to use.
- ACE pipeline: the same agent, additionally equipped with a trained playbook in which successful search strategies and errors have been systematically collected.
Key findings from the project
The project demonstrated that a complex AI concept such as ACE can be successfully implemented in a realistic pipeline. It proved that the AI system can learn from its own errors. As early as the second run, queries that had failed on the first attempt were successfully resolved using the amended playbook. ACE thus achieves genuine ‘learning from experience’ without the need to retrain the underlying models. Furthermore, the manual effort involved in prompt engineering was reduced. Instead of manually refining individual entries and system prompts, ACE creates a clearly defined optimisation process that makes improvements reproducible.
However, due to the limited proportion of the project, no statistically significant improvement rates can be derived from the three variants examined. The results of the original ACE experiments provide an indication of the approach’s potential: on the AppWorld benchmark, which examines complex agent-based tasks, ACE improves the benefit compared with the comparison methods considered there by an average of 10.6 percentage points[3] . The authors thus demonstrate that an agent can become significantly more capable simply through the systematic refinement of its context.
Due to the different benchmarks used, the results of the paper cannot be directly transferred to the experimental setup. However, they confirm the observation that a pre-trained playbook can improve an agent’s problem-solving abilities.
Furthermore, the project yielded important insights through the analysis of the strategies collected in the playbook, thereby improving the traceability of the overall AI system:
- Difficult queries and recurring errors were identified.
- Quality issues in the training data were identified.
- Critical issues in the search tool’s design or in the evaluation strategy were identified.
ACE thus provides developers with deep insight into the functioning and vulnerabilities of the implemented AI processes.
Conclusion
ACE is a key segment in further improving the use of AI assistants:
- Experience gained at the TUM Data Innovation Lab is directly incorporated into the further development of our AI solutions – for example, in msg.ask:it and other agent-based systems in the insurance sector.
- ACE is a methodological framework for integrating and controlling learning processes within AI systems.
- In the long term, this is an important step towards continuously learning AI assistants while ensuring that their evolution remains transparent to insurers – particularly in the context of regulatory requirements. This is made possible because the evolving playbook is readable and therefore auditable.
The student project not only demonstrated how ACE can be implemented in a specific pipeline, but also provided valuable guidelines for real-world insurance applications, such as the automatic processing of customer enquiries. In this context, domain-specific best practices can be derived from actual processing errors and human feedback, helping to make automated workflows more robust and transparent.
[1] Q. Zhang, C. Hu, S. Upasani, B. Ma, F. Hong, V. Kamanuru, J. Rainton, C. Wu, M. Ji, H. Li, U. Thakker, J. Zou, and K. Olukotun, “Agentic Context Engineering: Evolving Contexts for Self-Improving Language Models,” 2025, arXiv:2510.04618.
[2] Xanh Ho et al. “Constructing a Multi-hop QA Dataset for Comprehensive Evaluation
of Reasoning Steps”. In: Proceedings of the 28th International Conference on
Computational Linguistics (COLING). 2020.
[3] Q. Zhang, C. Hu, S. Upasani, B. Ma, F. Hong, V. Kamanuru, J. Rainton, C. Wu, M. Ji, H. Li, U. Thakker, J. Zou, and K. Olukotun, “Agentic Context Engineering: Evolving Contexts for Self-Improving Language Models,” 2025, arXiv:2510.04618.