From Skill Discovery to Skill Reuse: A Modular Path for AI Agents
This article explains why AI agents need modular skills, breaks the problem into four core subproblems—discovery, representation, composition, and reuse—and shows how structured skill contracts make behavior transferable, editable, and testable. It covers semantic skill segmentation, layered orchestration with explicit failure handling, the boundary between reusable contracts and parameters that must be relearned, evaluation metrics, and a practical adoption roadmap.
1. The Starting Point: Why Agents Need “Skills”
In 1999, reinforcement learning researchers Rich Sutton, along with his students Doina Precup and Satinder Singh, proposed a theoretical framework known as the options framework. Its core claim was that an agent should not start from scratch and trial-and-error its way through every task. Instead, it should be able to discover reusable behavior modules on its own and compose them when needed. This was the first time reinforcement learning formally proposed an abstraction close to a “skill.”
However, limited by the modeling techniques of that era, skills were implicitly compressed into the weight matrices of neural networks: not interpretable, not transferable, and not editable. Train a “open the door” skill, and switching to a different environment made it nearly impossible to reuse. This difficulty was not a flaw in implementation details, but a mistake in choosing the wrong level of representation.
2. Four Core Subproblems of Skill Modularity
Treating a “skill” as a first-class citizen requires answering four questions at the same time, none of which can be missing.
- Skill discovery: How to segment meaningful fragments from trajectories, rather than cutting them by a fixed time window.
- Skill representation: What data structure to use to carry a skill so that it is readable, searchable, and modifiable.
- Skill composition: How to orchestrate existing skills into long-horizon tasks, handling temporal dependencies and failure fallback.
- Skill reuse and transfer: When the environment changes or the goal changes, which parts can be kept and which must be retrained.
The traditional approach mixes all four into a single end-to-end network. The result is that adjusting any one link affects the whole system, which is hard to maintain in engineering practice.
3. Representation Determines Transferability: From Weights to Structured Contracts
To make skills transferable, the first step is to decouple the skill from the parameters and describe it with a structured contract. A practical skill contract should contain at least:
- Preconditions: the state constraints the world must satisfy before entering the skill;
- Action interface: the callable atomic operations and their parameter ranges;
- Termination conditions and success criteria: a verifiable completion signal;
- Failure modes and fallback strategies: behavior on timeout, conflict, or insufficient resources;
- Resources and side effects: the quota consumed and the external state written.
Illustrative description (platform-agnostic):
skill:name: open_doorprecondition: "door.locked == true && agent.within(door, 1.5m)"actions: [approach(door), rotate(handle, 90deg), push(door)]success: "door.open == true"timeout: 8son_failure: [recalibrate_pose(), retry(1)]side_effects: ["state.door.changed"]
The value of this approach is that a skill becomes a reviewable text asset. It can go into version control, go through code review, and be released gradually or rolled back. In engineering practice for intelligent coding and agents, Baidu AI Cloud also commonly emphasizes externalizing behavior logic into versionable configurations and process definitions, rather than burying it in invisible parameters.
4. Skill Discovery: From Time-Based to Semantic Segmentation
Early approaches often segmented trajectories by fixed step size or reward change points, but the problem was sensitivity to noise. A more robust approach is to jointly determine boundaries from multiple signals:
- Abrupt change in state distribution: a step change appears in a key state dimension;
- Change in control signal: the mean and variance of the policy output change at the same time;
- Subgoal achievement: a verifiable criterion switches from false to true;
- Semantic markers in language or logs: a stage conclusion appears in the execution trace.
In engineering, it is recommended to “coarse-cut first, then merge, then name”: coarse cutting produces candidate fragments, merge away fragments that are too short or semantically duplicated, and finally solidify them with a reusable naming convention for easy search and invocation.
5. Composition and Orchestration: Treat Skills as Functions, Not Black Boxes
Once a skill is contract-based, composition degenerates into a classic orchestration problem. A three-layer structure is recommended:
- Atomic skill layer: single responsibility, independently testable;
- Process orchestration layer: declares order, parallelism, conditional branches, and retries;
- Goal planning layer: selects a process based on the current state, and dynamically generates a new process when necessary.
def plan(state, goal):if not state.door.open:return sequence("enter_room", [approach_door, open_door, cross_threshold])if goal.type == "fetch":return sequence("fetch", [locate(target), grasp(target), deliver(goal.place)])return sequence("idle", [wait_and_observe])
The key point is that failure handling must be explicitly modeled: timeouts, unmet preconditions, and side-effect conflicts should all have deterministic fallback paths, rather than letting the model “improvise freely.”
6. The Boundary of Transfer: What You Can Take and What Must Be Relearned
What is usually transferable: skill contracts, preconditions and success criteria, orchestration logic, and failure-handling templates.
What usually needs to be relearned: perception mappings and low-level control parameters coupled to a specific environment.
Therefore, a two-stage transfer approach of “contract reuse + parameter adaptation” is recommended: first reuse the structure, then calibrate the parameters with a small amount of interaction data, avoiding the cost and instability of full retraining.
7. Evaluation System: No Measurement, No Modularity
It is recommended to cover at least four categories of metrics:
- Reuse rate: the proportion of existing skills invoked in a new task;
- Composition success rate: the end-to-end completion rate of long-horizon tasks;
- Editing cost: the minimum number of units changed and the regression scope required to modify one skill;
- Interpretability: whether you can directly read from the trace “which skill was used and why it failed.”
Supporting engineering capabilities can be carried by common industry categories, for example object storage to hold skill assets, a message queue to decouple execution events, a container platform to host sandboxed execution, and logging services with monitoring and alerting to provide observability.
8. Recommended Adoption Roadmap
- First establish a skill contract specification and naming convention, unifying the review standard;
- Choose two or three high-frequency tasks to extract atomic skills, and get the “discovery—solidification—reuse” loop working end to end;
- Introduce an orchestration layer and explicit failure handling, first rolling out gradually in a sandbox environment;
- Build an evaluation dashboard, driving iteration with reuse rate and composition success rate;
- Only then consider letting the agent participate in the autonomous discovery of new skills, avoiding premature automation.
Conclusion: The real legacy of the options framework is not a particular algorithm, but the engineering intuition of “modularizing behavior.” When a skill moves from weights into a contract, an agent gains the engineering properties of being interpretable, transferable, and editable for the first time, and the path toward modularity truly begins.
