AI Agent Self-Improvement: From One-Off Sessions to Reusable SOPs

    AI agents can solve complex tasks within a session yet fail to retain what they learn across sessions. This article explains how a persistent skills layer turns execution experience into reusable standard operating procedures, covering skill extraction, storage and retrieval, runtime reuse, and in-place updates. It also outlines engineering considerations for shared skill libraries, including concurrency, access control, auditing, and cloud infrastructure.

    1. The Problem: Why Many AI Agents Keep Repeating Mistakes

    Many AI agent frameworks and coding tools share a familiar limitation: they reason effectively within a session but fail to retain lessons across sessions.

    During a session, a model can use context to reason through a problem, test approaches, adjust its strategy, and complete a complex task. Once that session ends, however, the experience it accumulated—failed approaches, verified command sequences, and useful workarounds—may disappear. The next task starts with the same static system prompt and tool documentation.

    This creates three recurring problems:

    • Wasted resources: Agents repeat the same trial-and-error process, adding token usage and execution time.
    • Inconsistent quality: Success depends heavily on exploration within each individual session rather than accumulated experience.
    • Limited team reuse: Lessons discovered by one person’s agent cannot easily be transferred in a structured form to other users or agent instances.

    From an engineering perspective, this is an architectural gap: the system lacks a persistent learning layer. Even when model parameters remain frozen, an application can preserve operational experience as external assets. That is the starting point for this form of agent self-improvement.

    2. The Core Idea: Turn Exploration into Reusable SOPs

    Some open-source agent projects introduce a subsystem commonly called Skills. Its purpose can be summarized as follows:

    Turn one-off exploration into a reusable standard operating procedure (SOP). Use it for the next relevant task, and revise it when execution reveals that it is inaccurate or outdated.

    This creates a feedback loop with four stages:

    1. Skill extraction: Identify useful lessons from a completed task’s execution trace.
    2. Skill storage: Persist those lessons in a structured format that supports retrieval and version management.
    3. Runtime reuse: Search the skill library before starting a new task.
    4. In-place correction: Update outdated or incorrect skills when execution exposes a problem.

    Here, self-improvement happens at the application layer, not through changes to the model’s parameters.

    3. Extracting Skills from Execution Traces

    The main challenge in skill extraction is deciding which experience deserves to be retained. An execution history may contain many unsuccessful branches, and not every step is useful.

    Common extraction strategies include:

    • Outcome-based filtering: Retain the key decisions along the path that ultimately succeeded.
    • Comparison with existing SOPs: Identify new workarounds or corrections by comparing the execution with an existing procedure.
    • Summary compression: Reduce a lengthy trace to a compact sequence of prerequisites, actions, and expected outcomes.

    An illustrative skill entry might look like this:

    1. skill_id: deploy-webapp-rollback
    2. trigger: "Deployment fails with a health-check timeout"
    3. steps:
    4. - "Roll back to the previous image version"
    5. - "Wait for instances to become ready, then retry the health check"
    6. preconditions: "An image version retention policy must be in place"
    7. last_verified: "2025-01-15"
    8. success_rate: 0.92

    This structured representation makes skills searchable and provides a basis for later revision or retirement.

    4. Designing Skill Storage and Retrieval

    A skill library needs to balance retrieval efficiency with management overhead. Common engineering approaches include:

    • Organization by task domain: Group skills into areas such as operations, data analysis, and document processing to avoid searching the entire library.
    • Semantic and keyword indexing: Use vector search or keyword indexes to locate relevant skills when a task begins.
    • Metadata management: Record verification dates, success rates, and applicability conditions to support maintenance and retirement decisions.

    The skill library is an application-layer knowledge asset, independent of model parameters. This makes it well suited to team collaboration: an SOP developed by one engineer’s agent can be shared across the team’s agent instances, rather than requiring everyone to rediscover the same workflow independently.

    5. Runtime Reuse: Search Before Acting

    With a skill library in place, task execution shifts from exploration by default to retrieval first:

    1. Receive a task
    2. → Search the skill library for relevant SOPs
    3. → Relevant, trustworthy match → Execute the SOP
    4. → No match or low confidence → Use the agent's normal reasoning and exploration
    5. → Successful exploration → Extract and store a skill

    For repetitive tasks, this approach can skip much of the trial and error, improving response time and task success rates. For unfamiliar tasks, the agent falls back to its normal reasoning process rather than depending on an unsuitable SOP.

    The practical benefit comes from reusing validated experience instead of repeatedly reconstructing it within a temporary context.

    6. In-Place Correction: Keeping SOPs Current

    Environmental change is a major source of failure for static documentation. API updates, dependency changes, and external platform rule changes can invalidate a previously correct procedure.

    The self-improvement loop addresses this through in-place correction. If an agent follows an SOP and observes a result that differs from the expected outcome, it treats the mismatch as a signal to revise the corresponding skill rather than simply stopping with an error.

    A revision may involve:

    • Adding a newly discovered prerequisite.
    • Replacing a step that no longer works.
    • Refreshing the verification timestamp.

    This gives the skill library the characteristics of living documentation. Combined with periodic success-rate analysis and retirement of low-performing skills, the mechanism helps maintain a more reliable collection of procedures.

    7. Engineering Considerations and Cloud Infrastructure

    Enterprise implementations need to address several additional concerns:

    • Concurrent updates: When multiple agent instances revise the same skill, optimistic locking or version numbers can help manage write conflicts.
    • Permissions and auditing: A shared skill library is a team asset and should be governed through centralized access controls and operation logs.
    • Storage and asynchronous processing: Object storage or document databases can hold skill entries. Message queues can support asynchronous extraction so that it does not block the main task workflow.
    • Deployment and observability: Supporting services can run on container platforms, with logging, monitoring, and alerts used to track metrics such as skill retrieval hit rate.

    Cloud platforms, including Baidu AI Cloud, offer established infrastructure categories such as object storage, message queues, container platforms, and logging services. Teams can use these types of managed services rather than building every underlying component themselves.

    8. Conclusion

    The value of this self-improvement mechanism is that it works within the constraint of frozen model parameters. By preserving experience at the application layer, an agent system can become more effective through repeated use without changing the underlying model.

    Moving from “start from scratch every time” to “reuse and refine prior experience” is more than a workflow optimization. It turns transient task execution into a persistent engineering asset. For teams building long-running AI agent systems, skill extraction, reuse, and in-place correction deserve first-class consideration in the architecture.