Agent Experience Transfer Across Models and Tasks: A Practical Guide to Self-Improvement

    This article explains how to build a self-improving Agent by evolving its external harness rather than retraining the model. It covers how to turn every change into a portable experience record with evidence, scope, and cost; three transfer channels across models, data, and tasks; a closed loop from feedback to candidate versions; and safeguards against experience pollution through evaluation isolation, regression tests, and budget limits. Engineering practices for versioning, canary rollout, observability, and cost control are also included.

    1. The Starting Point: Agent Capability Lives Outside the Model Weights

    The performance of a coding assistant or a task-oriented Agent is rarely determined by the underlying model alone. How prompts are organized, which tools the Agent is allowed to call, how tool results are truncated and fed back, and whether the Agent retries or stops when something goes wrong are all program-level decisions made outside the model. The industry commonly refers to this layer as the harness. The harness determines how model capability is actually invoked, and it explains why the same model can perform so differently across tasks.

    Recursive self-improvement (RSI) can happen entirely at this layer: run the current version, collect feedback, propose changes, and use evaluation to select the next version. The task model’s weights stay frozen; what actually gets rewritten is the external program. The direct benefits are predictable cost, auditable changes, and fast rollback, without the uncertainty of retraining or fine-tuning.

    The difficulty appears just as quickly: a change that works in the source environment may no longer be appropriate on a new model or a new task. A prompt structure that converged on a long-context summarization task may amplify noise when moved to a multi-turn tool-calling scenario; a fault-tolerance routine designed for one response format may introduce extra branches when it meets a different API style. So the core of cross-model and cross-data transfer is not moving the optimized code, but moving the rationale that produced those changes.

    2. Making Experience a First-Class, Portable Object

    Most practices keep only the code of the final version, which almost inevitably fails during transfer, because the receiving side does not know the preconditions behind each change. Portable experience should contain at least four kinds of information:

    • Change content: the diff described in a unified format, not a full-file overwrite.
    • Triggering evidence: which failure cases and which metric movements led to the change.
    • Applicability boundary: preconditions such as task type, input length range, tool set, and model capability tier.
    • Expected effect and cost: the metric expected to improve, plus the acceptable increase in latency and call volume.

    A sample experience entry looks like this (field names are illustrative only):

    1. {
    2. "id": "exp-0142",
    3. "change": "tool_result_truncate: head=2000,tail=500",
    4. "evidence": {"failed_cases": 17, "metric": "task_success", "delta": "+0.06"},
    5. "scope": {"task": "repo_qa", "input_tokens": "8k-32k", "tools": ["search","read_file"]},
    6. "cost": {"latency_ms": "+120", "calls": "+0.3"},
    7. "rollback": "exp-0139"
    8. }

    With this structure, transfer becomes “match against boundaries, then apply selectively” instead of pouring an entire rule set into the new environment indiscriminately.

    3. Three Transfer Channels: Across Models, Data, and Tasks

    Cross-model transfer is about adapting the harness to differences in model capability. Models differ in instruction-following strength, long-context stability, and reliability of structured output, so prompt constraints originally added for correction may become redundant or even distracting. A workable approach is to tier the constraints: keep hard constraints (output format, forbidden actions) and re-run a small-scale search for soft prompts (style preferences, number of examples) on the new model.

    Cross-data transfer is about shifts in the input distribution. When the average length, noise ratio, or domain terminology density of new data changes, truncation strategy, number of retrieved snippets, and reranking thresholds all need recalibration. The scope field in experience entries acts as a filter here, applying only changes that overlap with the current distribution.

    Cross-task transfer is about differences in goals and termination conditions. A summarization task can “stop once reading is done,” while a repair task that requires multi-step verification must have a verification loop. Termination conditions are a high-risk transfer item and should not be transferred by default unless clear evaluation evidence supports it.

    4. Closing the Loop: From Feedback to Candidate Versions

    A runnable self-improvement loop typically has five stages:

    1. Collection: log the input summary, intermediate steps, tool returns, final result, and failure reason for each run, with desensitization and minimal retention.
    2. Attribution: cluster failures and distinguish insufficient model capability, harness defects, and tasks that are inherently unsolvable.
    3. Proposal: generate candidate changes only at the harness layer, keeping each change small and explainable.
    4. Evaluation: compare candidates against the baseline on a fixed held-out set while also watching cost metrics.
    5. Promotion or rollback: if the gate passes, write to the experience store and update the version; otherwise roll back and record the negative result.

    Negative results are valuable experience too. Recording “which class of change is ineffective under which boundary” significantly reduces repeated trial and error later.

    1. def improve(loop_id, harness, gen_candidates, evaluate, gate, exp_store):
    2. baseline = evaluate(harness, loop_id)
    3. for cand in gen_candidates(harness, exp_store):
    4. score = evaluate(cand, loop_id)
    5. if gate(score, baseline): # dual gate on effect and cost
    6. exp_store.add(cand.experience) # keep the rationale, not just the code
    7. return cand, score
    8. exp_store.add_negative(cand.experience)
    9. return harness, baseline

    5. Preventing Experience Pollution: Evaluation and Regression Guardrails

    The biggest risk in self-improvement is overfitting to the evaluation set, producing “experience pollution” that looks like improvement but is actually degradation. The defenses include: strictly isolating the evaluation set from the samples used for proposals and rotating it regularly; keeping a set of general regression cases that span models and tasks, which no change may significantly harm; setting budget caps on prompt length and number of tool calls to avoid trading quality for score by piling on material; and giving each experience entry a validity period so it automatically expires after input distribution drift and triggers recalibration.

    6. Engineering Implementation Notes

    • Versioning: version the harness, the experience store, and the evaluation set independently so any change is traceable.
    • Canary rollout: run the new version on low-risk traffic first, then ramp up gradually.
    • Observability: use general-purpose logging and monitoring with alerting, and build dashboards for success rate, step count, call volume, and termination reasons.
    • Storage and isolation: experience entries and run traces are well suited to object storage, with read/write permissions isolated per environment.
    • Cost control: put evaluation frequency and candidate count into the budget so the loop itself does not become the main expense.

    If you rely on general cloud capabilities, a stable combination is a container platform hosting the run and evaluation tasks, a message queue decoupling collection from attribution, and object storage holding traces and experience entries, without binding to any specific vendor’s APIs.

    7. Conclusion

    Continuous self-improvement across models and data is essentially about treating “why we changed it” as equally important as “what we changed.” Freezing the task model’s weights and evolving only the external harness makes the improvement process low-cost and rollback-friendly, while structured experience representation, strict evaluation gates, and regression guardrails determine whether that experience still holds after switching models or tasks. Following this framework, an Agent can keep getting stronger across environments while carrying its experience along, instead of starting from zero at every transfer.