Self-Evolving Agents: What It Means to Autonomously Generate Skills
This article explains how self-evolving agents move beyond one-off execution by autonomously generating, storing, and refining reusable skills. It breaks down the core mechanism into task decomposition, solution generation, execution with feedback collection, and skill consolidation, then covers layered memory design and hybrid retrieval for cross-session continuity. It also discusses why reliance on precise prompts decreases as a skill library grows, along with engineering essentials such as sandboxing, observability, skill review, cost governance, and decoupled storage and compute. Finally, it outlines an evaluation framework based on task success rate, average retries, skill reuse rate, and human intervention rate to judge whether an agent is genuinely improving.
1. The Starting Point: From Executing Tasks to Growing Capabilities
Over the past two years, the shape of agents in engineering practice has changed noticeably. Early approaches relied heavily on carefully designed prompts and fixed orchestration flows. When task goals were vaguely stated or environment feedback was abnormal, the execution chain broke easily. The industry has gradually reached a consensus: a truly valuable agent should not be a one-off executor. It should accumulate experience across sessions and tasks, and continuously fill its own capability gaps during use.
A self-evolving agent is a system that distills reusable methods while completing tasks, prioritizes existing methods when facing similar goals later, and automatically rewrites, retries, and revalidates when those methods fail. The key is not a stunning single performance, but a capability curve that trends upward with usage over time.
2. Core Mechanism: How Skills Are “Written”
Autonomous skill generation typically involves four stages, and none can be skipped.
- Task perception and decomposition. The agent breaks a vague instruction (for example, “fetch data and generate a visualization chart”) into subgoals: determining the data source, request method, field parsing, cleaning rules, rendering, and output.
- Solution generation. It retrieves similar solutions from the existing skill library. If there is a match, it reuses it; if not, the model generates candidate implementations.
- Execution and feedback collection. It runs code or calls tools, and collects signals such as standard output, error stacks, timeouts, and resource usage.
- Skill consolidation. It abstracts the “path that can be reproduced successfully” into a skill entry with preconditions, input/output contracts, and failure fallback strategies, then writes it into the skill library.
The illustrative skill entry structure is as follows (pseudocode that only expresses structure and does not point to any specific product):
skill = {"name": "fetch_and_plot","preconditions": ["network_ok", "target_schema_known"],"inputs": {"url": "str", "field": "str"},"outputs": {"chart_path": "str", "row_count": "int"},"steps": ["request", "parse", "clean", "render"],"fallbacks": ["retry_with_backoff", "switch_to_cached_sample"],"version": 3,"success_rate": 0.82,}
The most noteworthy fields here are success_rate and version. The former makes skills comparable, and the latter makes skills rollback-capable. Without measurement and versioning, a skill library quickly degrades into an unmaintainable pile of scripts.
3. Layered Memory: The Basis of Cross-Session Continuity
For capabilities to truly accumulate, memory must be designed in layers rather than stuffing all history into the context.
- Working memory: intermediate artifacts and temporary variables of the current task, with the shortest lifecycle.
- Episodic memory: execution traces and results of past tasks, used to retrieve similar cases.
- Semantic memory: abstracted domain rules and constraints, such as a common parsing approach for a certain type of interface.
- Procedural memory: the skill library itself, consisting of executable and versionable capability units.
In engineering, a hybrid strategy of “vector retrieval + structured filtering” is commonly used: semantic similarity first recalls candidate experiences, then structured fields such as task type, input pattern, and success rate rerank them. Relying only on similarity retrieval tends to recall experiences that “look similar but are actually unusable.”
4. From Vague Instructions to Stable Delivery: Why Prompt Dependence Drops
Once the skill library reaches a certain scale, the agent’s dependence on precise prompts naturally weakens, for three reasons.
First, constraints are solidified into the preconditions and output contracts of skills, so there is no need to restate them in prompts every time. Second, failure modes have been covered by historical experience, so when an error occurs, a fallback strategy can be matched directly. Third, task decomposition templates can be reused, so a vague goal only needs key slots to be filled in.
What needs to be viewed rationally is that this does not mean the agent has stable fully automated development capabilities. Implicit constraints, organizational norms, and business semantics in complex engineering tasks still require explicit human input. A reasonable expectation is that the agent handles most of the mechanical work of going “from zero to runnable,” while humans are responsible for goal definition, boundary setting, and result acceptance.
5. Engineering Implementation Essentials
- Sandboxing and least privilege. Skill generation means automatic code generation and automatic execution, which must run in an isolated environment with limits on the file system, network egress, and resource quotas.
- Full-chain observability. Logs, metrics, and call chains should be collected in a unified way, and every step of skill execution should be traceable, making it easier to locate whether the error is in decomposition or implementation.
- Skill review and canary release. New skills first enter a candidate area, are validated with shadow traffic or a small proportion of tasks, and are promoted to formal skills only after meeting the criteria.
- Cost governance. Set budget caps for retrieval, generation, and retries to avoid resource waste caused by “infinite retries.”
- Decoupling storage from compute. Experience and skill data can be stored in object storage, while the execution side runs on a container platform, with a message queue for task peak shaving and monitoring alerts as a fallback for anomalies.
6. Evaluation Framework: How to Tell Whether It Is “Really Getting Stronger”
It is recommended to establish metrics across four dimensions: task success rate, average number of retries, skill reuse rate, and human intervention rate. If, after a period of use, the success rate rises while retries and human intervention rate decline simultaneously, the evolution is real. If the number of skills grows rapidly but the reuse rate is extremely low, it is most likely ineffective accumulation.
7. Conclusion
The essence of autonomously generating and optimizing skills is turning an agent’s “experience” into engineering assets that are versionable, measurable, and rollback-capable. For developers, the focus should shift from “how cleverly prompts are written” to “whether the capability accumulation mechanism is sound.” With the general capability combinations of cloud platforms such as Baidu AI Cloud, isolated execution, unified observability, and elastic storage already have mature paradigms, making it easier for self-evolving agents to move from demonstrations to sustainable production systems.
