Agent Self-Evolution Enters the Dual-Track Era: Coordinating Experience and Environment Context

    This article explains why AI agents that improve with repeated use still fail when the environment changes, and introduces a dual-track self-evolution framework that separates reusable methods from environment context. It covers the limits of single-track recursive self-improvement, how to build a versioned context track, how to prevent experience pollution with applicability metadata, and how a pre-execution applicability gate coordinates both tracks. A four-step rollout plan and evaluation metrics are included to help teams measure whether the mechanism works in practice.

    1. Background: Why Agents That Improve With Use Still Get Tripped Up by the Environment

    In agent engineering practice, a common pattern appears: the same model, the same execution framework (harness), and the same workflow orchestration can perform very differently across users or data environments. One colleague uses an agent to organize reports smoothly, but the same agent repeatedly fails to read files and requires frequent rework on their own data. The model has not changed, the harness has not changed—only the environment has.

    The root cause is not mysterious. The model provides reasoning and generation capabilities, and the harness organizes those capabilities into executable workflows, but the agent must still answer two questions at runtime:

    • What does the current environment look like (file layout, field structure, template constraints, interface conditions)?
    • Do the experiences accumulated in the past still apply in the current environment?

    If the answers to these two questions are not explicitly modeled, the agent’s “learning” degrades into fragile pattern memorization: it becomes more proficient in a specific environment but fails quickly when the environment changes.

    2. The Limits of Single-Track Evolution: Why Experience Accumulation Backfires

    The core loop of Recursive Self-Improvement (RSI) is: execute a task → collect feedback → distill experience → reuse experience. This loop works well in a single, stable environment, but it has three structural flaws.

    First, experience lacks applicability annotations. Experience is recorded as “step sequences” or “rule fragments” without the conditions under which it takes effect. Reuse performs no validation, which amounts to unconditional trust in history.

    Second, environment awareness lags behind environment changes. The agent keeps retrying old calls after interface conditions change, keeps using old parsing rules after data formats change, and keeps filling fields with old mappings after template constraints change. The more “proficient” the experience, the more often the wrong path is repeated.

    Third, failed experience cannot be correctly attributed. When results are wrong, the system struggles to distinguish “the method itself is wrong” from “the method is right but the environment does not match.” As a result, it either blindly keeps tuning the method or rolls everything back, leading to low learning efficiency.

    3. Core Idea of the Dual-Track Framework: Method Track and Context Track Evolve in Parallel

    The key to dual-track evolution is to split the previously mixed “how to do the work” and “facts about the environment” into two independently evolving tracks, and to run a matching check before execution.

    • Method Track (How Track): accumulates reusable execution strategies, tool-selection preferences, validation steps, and failure-recovery techniques.
    • Context Track: maintains structured awareness of the current environment, including resource layout, data schema, constraints, interface contracts, and their versions.

    Where the two tracks meet is an explicit “applicability check”: read the context track first, then retrieve from the method track, and execute only when the match holds; otherwise trigger environment probing or method degradation.

    The following pseudocode is illustrative—the focus is on order and decision-making, not specific interfaces:

    1. def run(task):
    2. ctx = context_track.observe(task.scope) # Update environment context first
    3. plan = method_track.retrieve(task.goal) # Then retrieve candidate methods
    4. verdict = applicability(plan, ctx) # Explicit applicability check
    5. if verdict.ok:
    6. return execute(plan, ctx)
    7. elif verdict.need_probe:
    8. ctx = probe(ctx, plan.required_facts) # Low-cost probing to fill missing facts
    9. return run(task) # Re-evaluate
    10. else:
    11. return degrade(plan, ctx) # Degrade the method or switch tracks

    4. Building the Context Track: Turning the Environment From Implicit Assumptions Into Explicit State

    The value of the context track is turning “default assumptions” into “queryable facts.” In practice, it is recommended to cover four categories of information.

    1. Resources and layout: how files and directories are organized, naming conventions, sharding and batching characteristics. Avoid hardcoding absolute paths; use a “locator strategy + validation” approach instead.
    2. Data schema: field sets, types, null ratios, encoding and delimiters, units and dimensions. Once the schema changes, parsing and aggregation rules must be reconfirmed.
    3. Constraints and templates: output format, required fields, metric definitions, compliance requirements. These constraints are often “not in the data” and must be maintained separately.
    4. Interface contracts: call preconditions, rate limits and timeouts, error-code semantics, version differences. Contract changes should be treated as environment change events, not occasional failures.

    In engineering terms, a versionable environment description file can carry the above information, combined with general-purpose catalog capabilities for persistence and distribution—for example, object storage to save description files, a configuration center to manage versions, a logging service to record change history, and monitoring and alerting to signal contract anomalies.

    1. environment:
    2. layout: {pattern: "batch_*/raw/*.csv", locator: "strategy_v2"}
    3. schema: {version: "2024-06", key_fields: [id, amount], unit: "CNY"}
    4. constraints: {template: "report_v3", required: [summary, total]}
    5. contract: {endpoint_semantics: "v2", retry_policy: "no_auto_retry"}

    5. Preventing Experience Pollution in the Method Track

    A larger method track is not necessarily better. An unvalidated experience library keeps amplifying errors. Three disciplines are recommended.

    • Applicability binding: every experience entry must record its effective conditions (environment fingerprint, schema version, contract version); filter first, then rank at retrieval time.
    • Tiered evidence recording: only “verified successes” can be promoted to strong experience; unverified successes are recorded only as weak experience; failure samples are stored separately for attribution.
    • Periodic regression and retirement: use a fixed set of regression samples to test whether experience is still valid; experience that goes unmatched for a long time is automatically downweighted or archived.

    Experience entries can be abstracted into the following structure:

    1. {
    2. "id": "exp_0421",
    3. "goal": "aggregate_monthly_report",
    4. "steps": ["locate", "parse", "normalize", "aggregate", "render"],
    5. "preconditions": {"schema_version": "2024-06", "template": "report_v3"},
    6. "evidence": {"verified_success": 12, "verified_fail": 1},
    7. "strength": "strong"
    8. }

    6. Applicability Check: The Key Gate for Dual-Track Coordination

    The check is recommended to use a two-layer strategy: “hard constraints first, soft scoring as fallback.”

    The hard-constraint layer validates non-negotiable items: whether the schema version matches, whether required fields exist, and whether the contract allows automatic retries. If any item fails, no execution attempt is made; the system goes directly to probing or degradation, avoiding wasted budget on ineffective retries.

    The soft-scoring layer, after hard constraints pass, produces a combined score from historical hit rate, recent success rate, and environment similarity to decide whether to use strong experience, weak experience, or a general fallback path.

    The direct benefit is that errors are no longer “repeated proficiently” but intercepted in advance; at the same time, failure samples can be accurately attributed to “environment mismatch,” feeding back into context track updates and forming a dual-track loop.

    7. Rollout Roadmap and Evaluation Recommendations

    A four-step rollout is recommended to avoid a one-time rewrite.

    1. Observe first: record the environment facts and execution results of each task without any automatic rewriting, and establish a baseline.
    2. Split into dual tracks: extract environment assumptions from existing prompts and workflows into environment descriptions, and extract steps into method entries with preconditions.
    3. Enable the gate: add applicability checks and probing at the execution entry point, initially running in “alert only, do not block” mode.
    4. Automate the loop: environment change events automatically trigger experience downweighting and regression, gradually enabling automatic blocking.

    Evaluation metrics should not look only at task success rate. It is recommended to also observe: first-attempt success rate after environment changes, average number of retries, share of invalid calls, and experience hit and retirement rates. Among these, “first-attempt success rate after environment changes” best reflects whether the dual-track mechanism is truly working.

    8. Conclusion

    An agent’s continuous improvement cannot rely only on accumulating method proficiency. Elevating environment awareness to a first-class citizen alongside execution methods—making experience carry its applicability domain and making matching checks happen before execution—is the reliable path for self-evolving systems to survive environment changes. Dual-track parallelism, explicit checks, and closed-loop regression together form a reproducible, measurable, and long-term evolvable engineering paradigm, which can also be implemented smoothly on top of general-purpose storage, configuration, logging, and monitoring and alerting capabilities such as those offered by Baidu AI Cloud.