Self-Evolving Agents: What Autonomous Generation and Optimization of Skills Means
This article explores the paradigm shift from prompt-driven to experience-driven AI agents. It explains how self-evolving agents autonomously generate, optimize, and compose skills, detailing the closed-loop architecture, memory layering, and practical impacts. Furthermore, it provides engineering practices and implementation suggestions to help developers build systems that continuously accumulate experience rather than relying on static prompts.
I. Paradigm Shift: From “Prompt-Driven” to “Experience-Driven”
Over the past two years, the mainstream usage of AI agents essentially involved hardcoding human logic into prompts. Developers repeatedly polished instructions, detailing the process, constraints, and output formats, while the model acted merely as an executor. The fragility of this approach is obvious: prompts are static, but tasks are dynamic. Changing the scenario or the model version often renders carefully tuned instructions ineffective.
The self-evolving agent attempts to change this premise. Its goal is not to front-load all intelligence into the prompt, but to allow the system to accumulate reusable experience during operation. After completing a task, it distills “how it was done, which path worked, and which pitfalls to avoid” into a structured product. When encountering a similar goal next time, it directly invokes this experience. The prompt is downgraded to an “initial task description,” while the true capability resides in the skill library and memory.
This shift is significant: the system’s capability growth curve no longer relies entirely on manual tuning but stems partly from usage itself.
II. Capability Boundaries: What Does Autonomous Skill Generation and Optimization Mean?
We need to converge the concept to avoid exaggeration. In general industry understanding, it encompasses three layers:
- Autonomous Generation of Skills: Facing ambiguous goals, the agent independently decomposes them into subtasks, selects tools and execution paths, and abstracts successful execution trajectories into a nameable, callable, and parameterizable “skill.”
- Autonomous Optimization of Skills: When similar tasks recur, the system revises the skill’s implementation and default parameters based on historical success rates, execution time, and error types, forming version iterations.
- Autonomous Retrieval and Composition of Skills: When a new task arrives, the system performs semantic matching to select candidate skills and then orchestrates them into an execution plan.
It must be clarified that this does not equate to “stable, fully automated development capability.” The correctness of generation results still depends on the underlying model’s capability, the determinism of the tool environment, and the completeness of the verification mechanism. Understanding it as “enhancement of experience reuse and process automation” is more accurate than viewing it as “autonomous software engineering.”
III. Technical Breakdown: How the Closed Loop is Formed
A viable self-evolving closed loop typically consists of five components:
Task Understanding and Decomposition: Translating ambiguous instructions into structured goals, annotating constraints, acceptance criteria, and available toolsets. Acceptance criteria are particularly crucial as they serve as the sole basis for determining “success or failure” later.
Execution and Feedback: Calling tools, reading errors, correcting parameters, and retrying. The core here is not the retry itself, but structurally recording every piece of feedback rather than letting it fade into the context.
Skill Abstraction: Compressing successful trajectories into skill entries. Insufficient abstraction leads to poor reusability, while over-abstraction loses key details. In practice, three parts are typically retained: input-output contract, key steps, and failure modes.
Retrieval and Orchestration: For new tasks, performing similarity matching first, then deciding whether to reuse, modify, or regenerate the skill.
Evaluation and Rollback: Since skills are essentially code, they must have tests and versions. Self-evolution without regression evaluation equates to continuously amplifying uncertainty.
The skill entry structure can be illustrated as follows:
{"name": "fetch_and_visualize","version": 3,"input_schema": {"source": "url|path", "metric": "string"},"output_schema": {"chart_path": "string", "summary": "string"},"steps": ["Parse data source", "Field cleaning", "Aggregation calculation", "Render chart"],"preconditions": ["Network reachable", "Fields contain time column"],"failure_modes": [{"symptom": "Missing field", "fix": "Fall back to fuzzy column name matching"},{"symptom": "Encoding anomaly", "fix": "Try multi-encoding detection"}],"eval": {"success_rate": 0.86, "avg_steps": 7, "last_run": "2026-08-20"}}
The scheduling logic for retrieval and reuse can be written as the following pseudo-code:
def run(task):plan = decompose(task) # Structured goal + acceptance criteriafor sub in plan.subtasks:cands = skill_index.search(sub.goal, top_k=5)skill = pick(cands, by=["success_rate", "cost"])result = skill.execute(sub.args) if skill else explore(sub)if not sub.verify(result):trace = record_failure(sub, result) # Structured feedback retentionskill = refine(skill, trace) if skill else synthesize(trace)result = skill.execute(sub.args)memory.write(sub.goal, skill.ref, result)return aggregate(plan, memory)
IV. Memory Layering: The Foundation of Cross-Session Continuity
“Remembering” requires a layered design. Stuffing all information into a single context is neither economical nor reliable:
- Short-term Memory: Intermediate states and tool returns of the current task, recycled when the session ends.
- Task Memory: Goals, paths, and result summaries of completed tasks, used for retrieving similar tasks.
- Skill Memory: Abstracted executable capabilities with versions and evaluation metrics.
- Preference Memory: Long-term constraints such as user output formats, language, and directory conventions.
In engineering practice, long-term memory is typically stored in object storage or databases, recalled via vector retrieval, and then fine-ranked using keyword and metadata filtering. Session states are kept in low-latency caches. Cross-platform continuity relies on a unified memory read-write interface rather than each endpoint maintaining its own.
V. What This Means: Four Practical Impacts
For Developers: Prompt burden decreases, but architectural requirements increase. The prerequisite for advancing ambiguous instructions is a standardized tool layer, readable error messages, and available verification methods. The capability focus shifts from “writing instructions” to “designing tool contracts and acceptance criteria.”
For Engineering Practices: The skill library becomes a first-class citizen requiring governance. Once skills can be auto-generated and self-modified, there must be code reviews, version numbers, change logs, rollback mechanisms, and regression test suites. Without these, the system will accumulate hidden defects over time.
For Security: Permission boundaries must be tightened. Autonomous generation means autonomous execution, and skills may involve file writing, network requests, and command calls. Reasonable approaches include defaulting to least privilege, requiring explicit confirmation for dangerous operations, keeping audit logs for all executions, and applying static checks and sandbox isolation to generated content.
For Costs: Observability support is required. Self-evolution significantly increases the number of calls and storage volume. You should integrate logging services and monitoring alerts, establishing dashboards for success rate, average steps, single-task cost, and skill hit rate to use data to judge whether evolution is truly converging.
VI. Implementation Suggestions
- Fix the tool contract (input-output schema, error codes) first before discussing autonomous generation; otherwise, feedback noise will drown out optimization signals.
- Build small-scale evaluation sets for each type of task to turn “whether the skill is getting better” into a quantifiable metric.
- Separate skill generation from skill activation. Newly added or modified skills should enter a candidate zone and only be promoted to the default version after passing evaluation.
- Memory writes must have elimination and deduplication strategies to prevent long-term memory from being polluted by low-value trajectories.
- For infrastructure, utilize general category capabilities: container platforms for running sandboxes, object storage for preserving skills and memory, message queues for decoupling long tasks, and log/monitoring systems for observability. On Baidu AI Cloud, these capabilities can be used as a combination of general products without relying on specific proprietary interfaces.
VII. Conclusion
Autonomously generating and optimizing skills is essentially turning “experience” into a versionable, evaluable, and reusable engineering asset. It reduces reliance on precise prompts but shifts complexity to tool design, evaluation systems, and permission governance. The rational expectation is to treat it as an execution framework capable of continuously accumulating process experience, rather than an automated developer replacing engineering judgment. The benefits of the former are already considerable, while the latter leaves the risks to the user.
