AWS Builder Center
Continual Learning: Building Agents That Improve Through Experience

Continual Learning: Building Agents That Improve Through Experience

Continual learning lets AI agents accumulate institutional knowledge over time. This guide covers the spectrum of approaches, from in-context learning and memory systems to loop engineering and reinforcement learning, and when to use each.

Principal Applied Scientist @AWS Prototyping

What Is Continual Learning?

Every organisation builds institutional knowledge — workflows, domain expertise, accumulated judgment — that makes it effective. The opportunity with AI agents is building a learning loop where that institutional knowledge compounds through use. Every improved workflow generates better signal, which accelerates the accumulation of tacit knowledge unique to the firm.
Companies that build this loop early gain an advantage that is hard to replicate, regardless of any individual model capability. The knowledge compounds through three mechanisms:
  • Adapt — the agent adapts as the domain shifts over time (APIs update, codebases evolve, user behaviour changes)
  • Accumulate — it accumulates expertise through repeated tasks (the 100th code review is faster than the 1st because the agent remembers what patterns recur in this codebase)
  • Personalise — it personalises to the specific team or user it serves (learning conventions, preferences, and constraints that make its output immediately useful rather than generic)

Critically, the learning should be owned by the organisation as much as possible. Memory, skills, evaluation suites, and training data are portable assets you retain regardless of which model you use. Fine-tuned weights are locked to a specific model checkpoint, but the training data, reward definitions, and evaluation infrastructure that produced them are yours — and can be reapplied when you upgrade or switch models.
There are five distinct approaches to continual learning, each suited to different situations. Understanding the full spectrum — including research-stage techniques like test-time training and evidence from benchmarks like CL-Bench on what actually works — helps builders decide which approaches to combine and when to invest in each. For managed implementations of memory and optimization loops, see  Amazon Bedrock AgentCore .

The Spectrum

Continual learning for agents spans a wide range — from lightweight runtime adaptation to heavyweight weight updates. Think of it as a spectrum ordered by how deeply the agent changes:
Approach
What changes
Persists across sessions?
Implementation cost
Example
In-context learning
Nothing — examples in prompt
No
Negligible
Few-shot prompting, full conversation history
Memory systems
External knowledge store
Yes
Low
Conversation memory, experience databases
Loop engineering
The harness (prompts, tools, routing)
Yes
Medium
Automated prompt evolution, self-improving scaffolds
Test-time training
Model weights (temporarily)
No
Medium-high
Gradient updates during inference
Post-training / RL
Model weights (permanently)
Yes
High
Continual pre-training, RL from task execution
Each approach trades off differently on cost, persistence, risk of forgetting, and how much the agent can actually change. No single approach dominates — they complement each other, and production systems often combine several. The sections below cover each in detail, including results from  Agent Training Kit  (open-source RL training for Strands Agents) for the post-training approach.

Catastrophic Forgetting

The reason continual learning is hard — and not just "train on more data" — is catastrophic forgetting. When a neural network learns new information, the weight updates that encode the new knowledge can overwrite the weights that stored previous knowledge. The model doesn't gracefully integrate new and old — it replaces.
This manifests differently depending on how the agent learns:
  • In-context: no parametric forgetting, but attention degrades over long contexts — information in the middle gets effectively lost
  • Memory: forgetting happens through consolidation errors — the wrong things get remembered or the right things get pruned
  • Harness evolution: old skills can be overwritten by new ones if the evolution isn't careful
  • Model weight updates: the classic catastrophic forgetting — fine-tuning on task B destroys performance on task A
The diagram below maps each approach by its persistence (x-axis) against its risk of forgetting (y-axis), with circle size representing implementation cost. Approaches that change model weights carry the highest forgetting risk; approaches that store knowledge externally carry almost none.

An important reframing: forgetting is not always catastrophic. Under bounded compute, an agent that selectively forgets information no longer relevant can outperform one that tries to remember everything. The real objective is not zero forgetting but maximum average reward over time.



In-Context Learning

The simplest form of continual learning — and a surprisingly strong baseline. The model sees examples, past interactions, or retrieved documents directly in its prompt. Nothing changes persistently; the "learning" exists only within the session.
How builders use it: few-shot prompting (inject examples of desired behaviour), retrieval-augmented generation (pull relevant documents at query time), and full conversation history preservation (let the model see everything that happened so far).
Limitations: bounded by context window size, nothing persists between sessions, and performance degrades as context grows (the "lost in the middle" phenomenon where information in the middle of long contexts gets effectively ignored). The agent cannot improve its own behaviour — only its information within a single session.
Does it actually work? CL-Bench (Asawa et al. 2026) is the first rigorous benchmark measuring whether agents genuinely improve through sequential experience. It tests across six domains — each with discoverable latent structure that a learning system should exploit. The results are striking:
Rank
System
Model
Norm. gain (%)
Cost ($)
1
ICL (full context)
Claude Sonnet 4.6
25.4 ± 3.6
30.4
2
ICL (full context)
GPT-5.4
20.1 ± 9.1
18.4
3
Claude Code
Sonnet 4.6
23.9 ± 5.7
38.6
4
Mem0
GPT-5.4
20.2 ± 5.9
18.3
5
ICL (full context)
Claude Opus 4.7
19.5 ± 4.1
49.6
6
ICL Notepad
GPT-5.4
7.8 ± 3.0
14.3
7
ICL (full context)
Gemini 3 Flash
16.4 ± 3.8
7.6
8
Codex
GPT-5.4
14.6
27.2
9
ACE
GPT-5.4
8.6 ± 2.5
62.8
Normalised gain = improvement over that system's own stateless baseline. The most expensive system (ACE at $62.8/run) ranks near the bottom.
Full-context ICL — simply preserving the entire conversation history without truncation — outperforms dedicated memory systems. Before investing in infrastructure, check whether this baseline already meets your needs.
No continuous training loop for ICL — nothing persists beyond the session, so there's nothing to trigger, validate, or roll back.



Memory Systems

Memory systems store knowledge externally — outside the model's parameters — so learning new things never risks overwriting old capabilities. The model itself stays frozen; what changes is the knowledge it has access to.
After each interaction, the agent extracts key information (what worked, what failed, what the user prefers) and writes it to a persistent store. Before future interactions, relevant memories are retrieved and injected into context.
The hard part is retrieval, not storage. Most memory systems fail not because they forget — but because they retrieve irrelevant memories (adding noise) or miss relevant ones (leaving knowledge unused). Effective memory systems need: relevance scoring, recency weighting, consolidation (merging related memories), and pruning (removing stale entries).

Implementation

A practical tiered architecture:
Tier
Trigger
What happens
Conversation summarisation
Continuous
Role-specific compaction of the current session
Cross-session memory
End of session / periodic
Key findings written to persistent store
Consolidation
Store exceeds threshold
LLM rewrites many entries into fewer structured ones
What to build
Signals to capture
Memory write/read hooks, consolidation triggers, retrieval scoring
User corrections, successful patterns, domain facts
For a practical implementation,  Amazon Bedrock AgentCore Memory  provides managed semantic, summary, and user-preference memory strategies with built-in consolidation. For agents that need to learn from their own problem-solving journeys — not just store facts —  AgentCore episodic memory  captures the full reasoning trajectory (goal, actions, outcomes, reflections) and synthesises cross-episode insights that improve future decisions.

The continuous training loop

Question
Answer
Where does the learning signal come from?
Agent writes findings after each interaction; retrieves before next
Who triggers the learning?
Automatic — per-interaction write, threshold-based consolidation
How is the new behaviour validated?
Retrieval relevance scoring; consolidation reviewed for accuracy loss
Rollback path
Delete or revert memory entries
Blast radius if it goes wrong
One agent gets bad context (low risk)



Loop Engineering (Harness Evolution)

Rather than changing the model, loop engineering changes everything around it — the prompts, tools, routing logic, and orchestration that make the model effective. The insight: most agent failures come from harness mismatches, not model limitations.

Implementation

A practical harness evolution loop:
The loop
1. Agent executes task
2. Evaluate outcome (automated tests, LLM judge, user feedback)
3. Diagnose failure (what went wrong and why)
4. Propose harness change (modify prompt, add tool, adjust routing)
5. Validate change (regression test against previous successes)
6. Deploy updated harness → back to step 1
Steps 2–5 can be automated (the " Last Harness " pattern, Seong et al. 2026) or human-in-the-loop. For runtime harness adaptation without changing models or evaluation environments, see  Life-Harness  (Xu et al. 2026). The key principle: never deploy a harness change without regression testing — evolution that fixes one failure mode while breaking another is net-negative.
Prompt optimization. Prompts can be evolved automatically rather than hand-tuned. GEPA (Agrawal et al. 2026) demonstrates that reflecting on execution trajectories in natural language — then mutating prompts accordingly — outperforms reinforcement learning (GRPO) by +6% while using 35× fewer rollouts. The key insight: the full trajectory (reasoning chains, tool calls, error messages) is already interpretable text that an LLM can learn from directly, making natural language reflection a richer signal than scalar rewards.
Skills as reusable knowledge. Skills (encoded as markdown files or structured prompts) are the unit of harness knowledge. They accumulate over time — new skills added when the agent encounters a new task pattern, existing skills refined when execution feedback reveals gaps.
Tool governance. Beyond prompts and skills, agents can also improve by refining their own tool usage — dynamically routing between tools based on learned preferences, iteratively improving tool configurations, and even creating new tools when existing ones prove insufficient. This is an underappreciated dimension of continual learning: the agent's capabilities expand, not just its knowledge.
What to build
Signals to capture
Prompt versioning, A/B test harness, skill registry, regression suite
Execution traces, failure diagnostics, LLM-judge scores
For a managed implementation of this loop,  AgentCore Optimization  automates the observe→evaluate→improve cycle: it analyses production traces to generate prompt and tool recommendations, validates changes via batch evaluation against known use cases, and runs A/B tests on live traffic with statistical significance before promotion.

The continuous training loop

Question
Answer
Where does the learning signal come from?
Execution traces + failure diagnostics collected per deployment
Who triggers the learning?
Automated evaluator or human-in-the-loop
How is the new behaviour validated?
Regression suite against previous successes; A/B comparison
Rollback path
Revert to previous harness version (git)
Blast radius if it goes wrong
All users on that harness version affected (medium risk)



Test-Time Training (TTT)

Test-time training sits between "just use a longer context window" and "fine-tune the model." It updates model weights during inference — the model learns from the context it's processing, compressing information into its parameters rather than holding everything in attention. After inference, the weight changes are discarded.
The idea traces back to fast weights — a secondary set of weights that change rapidly during processing while the main (slow) weights stay fixed. Standard attention doesn't learn during inference; it just stores and retrieves key-value pairs, with compute scaling quadratically (O(n²)) with context length. TTT (Sun et al. 2024) introduces actual fast weights — a subset of model parameters updated via gradient descent on the context as it arrives, compressing what's seen so far into a fixed-size learned state rather than an ever-growing cache. Recent work (Liu et al. 2026) showed this is mathematically equivalent to learned linear attention, unifying the two lines of research.
The core mechanism in practice: at each token (or mini-batch of tokens), the model takes a gradient step on a prediction loss over the context seen so far, updating a subset of its weights. The updated weights encode what the context taught it — the model reasons from the context rather than attending to it.
Why it matters for agents: long-running agents process enormous contexts — codebases, specifications, multi-hour interaction histories. Standard attention degrades as context grows (the "lost in the middle" phenomenon). TTT compresses structured input into the model's working knowledge, maintaining constant inference latency regardless of how much context preceded it.

Current state

Method
Context length
Key property
TTT-E2E (Tandon et al. 2025)
Up to 128K
Constant latency regardless of context
LaCT (Zhang et al. 2025)
Up to 1M
Large chunk updates, 70% GPU utilisation
The catch: TTT is not a drop-in addition to an existing deployment. It requires models trained with TTT objectives — the model's initialisation must be prepared for adaptation at inference time (meta-learning). Without this, test-time gradient steps don't land in useful regions of parameter space.
No continuous training loop for TTT — weight changes are discarded after each context, so there's nothing that persists to trigger, validate, or roll back.



Post-Training (Fine-Tuning and RL)

Post-training permanently updates model weights — moving knowledge from the context window into the model's parameters so it "just knows" rather than re-reading documents every query. This includes continual pre-training (incorporating new domain knowledge), parameter-efficient fine-tuning (LoRA, adapters), and reinforcement learning from task execution.
For agents specifically, RL is the most natural fit: the agent attempts tasks, receives outcome-based rewards, and updates its policy.

Implementation

 Agent Training Kit  (ATK, open-source from AWS Labs) makes  Strands Agents  trainable. It wraps a Strands agent with trajectory collection and PPO training — the agent executes tasks using its tools, outcomes are evaluated, and reward signals update the policy:
The RL training loop
1. Agent receives task
2. Agent executes (using tools, writing code, making decisions)
3. Outcome evaluated (tests pass? task succeeds? reward signal)
4. GRPO/PPO update (reward backpropagated through trajectory)
5. Next episode → back to step 1
ATK has been validated on coding (LiveCodeBench), math reasoning (AIME-2024), and planning tasks (Tau2-Bench). On coding tasks, agents show measurable improvement within 20 training steps. What's notable is that agents develop strategic behaviours not explicitly taught — for example, 11.4% of submissions included testing code before final submission, with 52.2% passing immediately and the remainder catching runtime errors that would otherwise propagate. This kind of emergent self-checking behaviour is a concrete example of what RL can teach agents that prompt engineering alone cannot.
What to build
Signals to capture
Training pipeline, trajectory collection, reward definition
Task outcomes, tool usage patterns, reward signals

The continuous training loop

Question
Answer
Where does the learning signal come from?
Trajectories accumulated with outcome rewards
Who triggers the learning?
Human decision when enough signal has accumulated
How is the new behaviour validated?
Held-out eval set; forgetting measured on retained capabilities
Rollback path
Roll back to previous model checkpoint or adapter
Blast radius if it goes wrong
All users on that model affected (high risk)



Putting It Together

Choosing your approach

Is the agent failing on tasks it should handle?
│
├─ YES → Are failures due to missing context or knowledge?
│ ├─ YES → Add memory systems (cross-session knowledge store)
│ └─ NO → Failures are harness-level (wrong tools, bad routing)
│ └─ Add loop engineering (evolve prompts, tools, routing)
│
└─ NO → Does the agent need to handle fundamentally new capabilities?
├─ YES → Do you run your own model?
│ ├─ YES → Post-training / RL
│ └─ NO → Loop engineering + memory (max out scaffold first)
└─ NO → Is context too long for attention to handle?
├─ YES → Evaluate TTT-capable architectures
└─ NO → Current approach is sufficient


Learning at multiple timescales

Each layer operates independently at its own cadence:
Cadence
What updates
Mechanism
Per-context
Temporary weight changes
Test-time training (if architecture supports it)
Per-interaction
External knowledge store
Memory write + retrieval
Per-deployment
Prompts, tools, routing
Loop engineering (harness updates)
Periodic
Permanent model weights
Fine-tuning / RL
The design principle: fast exploration feeds slow consolidation. Rapid in-context adaptation reveals what works. That evidence feeds into scaffold updates (medium timescale). Scaffold updates that prove stable over many deployments justify the investment of a weight update (slow timescale). Each layer validates the next — you don't fine-tune on a hunch; you fine-tune on patterns that memory and harness evolution have already confirmed.

Where the learning signal comes from

A complementary way to think about the training loop is not just where knowledge lives but where the learning signal originates (Ren et al. 2026):
Signal source
What it captures
Example
Intrinsic generative
Self-generated candidate solutions, self-play
Model generates multiple approaches, filters by quality
Intrinsic evaluative
Model's self-critique and consistency checks
Reflexion-style verbal reinforcement, rubric-based scoring
Extrinsic exploratory
Real environment outcomes
Tests pass/fail, task succeed/fail, user satisfaction
Most builder-oriented systems rely on extrinsic signals — the real-world outcome of the agent's actions. But intrinsic signals are underutilised: an agent that critiques its own outputs before committing them, or generates multiple approaches and selects the best, is already doing lightweight self-improvement without any training infrastructure.
The practical question for builders: what signals does your deployed agent already produce that you're not capturing? Execution logs, user corrections, retry patterns, and abandoned paths are all learning signal going to waste.

Validation: the critic as governed infrastructure

All continual learning creates a tension: the system changes over time, but you need confidence the changes are improvements. The evaluation system is not a nice-to-have — it's critical infrastructure that requires its own governance.
Three principles:
1. Regression test every change. When you update anything (memory, harness, weights), test on tasks the system previously handled well. If performance drops, your update introduced forgetting — and you need to decide whether the trade-off is acceptable.
2. Measure against downstream outcomes, not proxy metrics. Agents can appear to "learn" (intermediate metrics improve) while actually overfitting to surface patterns. The right evaluation is always against the outcome the system is deployed for.
3. Treat evaluation as infrastructure, not afterthought. Your evaluator needs versioning, governance, and protection from gaming — just like your production systems. An agent optimising against a weak evaluator will find ways to score well without actually improving. This is the "reward hacking" failure mode that scales with agent capability.

Implementation checklist

Action
Done when...
1. Instrument your agent — structured logs for every interaction (input, output, tools used, outcome)
You can replay any past interaction and evaluate it
2. Define success metrics — what does "better" mean for your use case?
You have automated evals that correlate with user satisfaction
3. Add memory — start with cross-session memory for user preferences and past failures
Agent references prior interactions without re-explanation
4. Version your harness — treat prompts, tools, and routing as code with git history
You can diff any two harness versions and A/B test them
5. Build a regression suite — 20-50 "must-still-work" cases from production
Every harness change runs against this before deploy
6. Close the loop — scheduled review of failure logs → harness updates → regression → deploy
Improvement cadence is measured (e.g., weekly failure rate trending down)



Key Takeaways

For...
Remember...
Executives
Agents that learn from experience deliver compound returns — each task makes the system better at future tasks. Own the learning artifacts (data, evals, skills) regardless of which model you use.
Architects
Five approaches on a spectrum, each with different persistence, cost, and forgetting risk. Most production systems combine 2-3. Use the decision flow to match approach to situation.
Engineers
Instrument first (structured logs), then close the feedback loop. For memory and harness evolution, 
 AgentCore 
 provides managed services. For RL-based post-training, 
 Agent Training Kit 
 is open-source and ready to use.

Learn More

  •  Strands Agents SDK  — open-source Python framework for building AI agents with tools, memory, and orchestration
  •  GEPA  — reflective prompt evolution outperforms RL by +6% with 35× fewer rollouts (Agrawal et al. 2026)
  •  The Last Harness  — automated harness evolution through Worker/Evaluator/Evolution agent loops (Seong et al. 2026)
  •  Life-Harness  — runtime harness adaptation from training trajectories (Xu et al. 2026)
  •  TTT-E2E  — test-time training with constant inference latency up to 128K context (Tandon et al. 2025)
  •  LaCT  — large chunk test-time training scaling to 1M tokens (Zhang et al. 2025)
  •  CL-Bench  — rigorous benchmark for agent continual learning; shows naive ICL outperforms dedicated memory systems (Asawa et al. 2026)
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article