Trajectory-Informed Memory Generation for Self-Improving Agent Systems
Organizations: Agents and Automation Lab, IBM Research USA
Abstract
LLM-powered agents face a persistent challenge: learning from their execution experiences to improve future performance. While agents can successfully complete many tasks, they often repeat inefficient patterns, fail to recover from similar errors, and miss opportunities to apply successful strategies from past executions. We present a novel framework for automatically extracting actionable learnings from agent execution trajectories and utilizing them to improve future performance through contextual memory retrieval. Our approach comprises four components: (1) a Trajectory Intelligence Extractor that performs semantic analysis of agent reasoning patterns, (2) a Decision Attribution Analyzer that identifies which decisions and reasoning steps led to failures, recoveries, or inefficiencies, (3) a Contextual Learning Generator that produces three types of guidance -- strategy tips from successful patterns, recovery tips from failure handling, and optimization tips from inefficient but successful executions, and (4) an Adaptive Memory Retrieval System that injects relevant learnings into agent prompts based on multi-dimensional similarity. Unlike existing memory systems that store generic conversational facts, our framework understands execution patterns, extracts structured learnings with provenance, and retrieves guidance tailored to specific task contexts. Evaluation on the AppWorld benchmark demonstrates consistent improvements, with up to 14.3 percentage point gains in scenario goal completion on held-out tasks and particularly strong benefits on complex tasks (28.5~pp scenario goal improvement, a 149% relative increase).
Figures & tables
| Type | Task Goal | Scenario Goal |
|---|---|---|
| Aggregate | 73.2 | 64.3 |
| Difficulty 1 | 91.2 | 89.5 |
| Difficulty 2 | 70.8 | 56.2 |
| Difficulty 3 | 58.7 | 47.6 |
| Type | Task Goal | Scenario Goal |
|---|---|---|
| Aggregate | 69.6 | 50.0 |
| Difficulty 1 | 89.5 | 79.0 |
| Difficulty 2 | 66.7 | 56.2 |
| Difficulty 3 | 54.0 | 19.1 |
| Type | Task Goal | Scenario Goal |
|---|---|---|
| Aggregate | 66.7 | 48.2 |
| Difficulty 1 | 86.0 | 68.4 |
| Difficulty 2 | 70.8 | 56.2 |
| Difficulty 3 | 46.0 | 23.8 |
| Type | Task Goal | Scenario Goal |
|---|---|---|
| Aggregate | 72.0 | 62.5 |
| Difficulty 1 | 91.2 | 84.2 |
| Difficulty 2 | 72.9 | 68.8 |
| Difficulty 3 | 54.0 | 38.1 |
| Type | Task Goal | Scenario Goal |
|---|---|---|
| Aggregate | 70.2 | 57.1 |
| Difficulty 1 | 91.2 | 84.2 |
| Difficulty 2 | 64.6 | 43.8 |
| Difficulty 3 | 55.6 | 42.9 |
| Type | Task Goal | Scenario Goal |
|---|---|---|
| Aggregate | 73.8 | 57.1 |
| Difficulty 1 | 91.2 | 73.7 |
| Difficulty 2 | 72.9 | 56.2 |
| Difficulty 3 | 58.7 | 42.9 |
| Tip Granularity | Retrieval Strategy | TGC | TGC | SGC | SGC |
|---|---|---|---|---|---|
| Baseline (no memory) | 69.6 | — | 50.0 | — | |
| Subtask-level | LLM-guided selection | 73.2 | +3.6 | 64.3 | +14.3 |
| Subtask-level | Cosine sim. ( ) | 73.8 | +4.2 | 57.1 | +7.1 |
| Task-level | Cosine sim. ( ) | 72.0 | +2.4 | 62.5 | +12.5 |
| Type | Task Goal | Scenario Goal |
|---|---|---|
| Aggregate | 91.1 | 83.3 |
| Difficulty 1 | 94.4 | 83.3 |
| Difficulty 2 | 88.9 | 83.3 |
| Difficulty 3 | 88.9 | 83.3 |
| Type | Task Goal | Scenario Goal |
|---|---|---|
| Aggregate | 86.7 | 73.3 |
| Difficulty 1 | 100.0 | 100.0 |
| Difficulty 2 | 77.8 | 58.3 |
| Difficulty 3 | 77.8 | 50.0 |
| Type | Task Goal | Scenario Goal |
|---|---|---|
| Aggregate | 89.5 | 73.7 |
| Difficulty 1 | 90.0 | 80.0 |
| Difficulty 2 | 87.5 | 62.5 |
| Difficulty 3 | 100.0 | 100.0 |
| Type | Task Goal | Scenario Goal |
|---|---|---|
| Aggregate | 77.2 | 47.4 |
| Difficulty 1 | 80.0 | 60.0 |
| Difficulty 2 | 70.8 | 25.0 |
| Difficulty 3 | 100.0 | 100.0 |
| Partition | Task Goal | Task Goal | Scenario Goal | Scenario Goal |
|---|---|---|---|---|
| (Baseline) | (+Memory) | (Baseline) | (+Memory) | |
| Test-Normal | 69.6 | 73.2 (+3.6) | 50.0 | 64.3 (+14.3) |
| Train | 86.7 | 91.1 (+4.4) | 73.3 | 83.3 (+10.0) |
| Dev | 77.2 | 89.5 (+12.3) | 47.4 | 73.7 (+26.3) |
LLM Agent Self-Improvement
Large language model agent self-improvement studies how agents use experience and feedback to improve their behavior, tools, and workflows.
See all 257 papers