Training Language Agents to Learn from Experience

Yuval Shalev, Zifeng Ding, Mateja Jamnik
5/19/2026
cs.LGcs.AIcs.CL

No confident code implementation found for this paper. 4 possible matches can be shown below.

Abstract

Language agents can adapt from experience in interactive environments, but current reflection-based methods can only self-correct within a single task instance. Whether such experience can be distilled into reusable lessons that improve performance on future unseen tasks remains unclear. We address this problem by introducing the In-context Training (ICT) task, a framework for evaluating cross-task self-improvement in language agents. In ICT, a reflector model observes trajectories collected by an actor model and generates system prompts intended to improve the actor's performance on future unseen tasks. We then propose an RL-based training pipeline for learning such reflections directly from experience, without human-provided examples. Across ALFWorld and MiniHack, our trained reflectors outperform an untrained baseline on most held-out task families, showing that the ability to learn from experience can itself be learned. In some cases, we observe generalisation beyond the benchmark on which the reflector was trained, to substantially different environments. Finally, we introduce MetaGym, a generic Python library for constructing meta-environments, enabling future research on self-improving language agents.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 4 weaker matches are hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{shalev2026training,
  title  = {Training Language Agents to Learn from Experience},
  author = {Yuval Shalev and Zifeng Ding and Mateja Jamnik},
  year   = {2026},
  eprint = {2605.20477},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2605.20477v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2605.20477.svg)](https://codeofpaper.com/paper/2605.20477)

Discussion