Agent Skills#
The MS-Agent Skill Module provides a knowledge-driven approach to extending LLM agent capabilities. Instead of building a separate execution pipeline, skills are treated as procedural knowledge β they describe how to do something, and the model itself executes the steps using its standard tools (code execution, file I/O, web search, etc.).
Architecture#
βββββββββββββββ ββββββββββββββββ βββββββββββββββββββββ
β Skill SourcesββββββΆβ SkillCatalog ββββββΆβPromptInjector β
β local / MS / β β load, filter,β β always skills: β
β git β β cache β β full body inject β
βββββββββββββββ ββββββββ¬ββββββββ β all skills: β
β β name+desc index β
β βββββββββββββββββββββ
βΌ
βββββββββββββββ ββββββββββββββββββββ
βSkillToolSet ββββββΆβ ToolManager β
β skills_list β β unified registry β
β skill_view β β (MCP + built-in β
β skill_manageβ β + skill tools) β
βββββββββββββββ ββββββββββ¬ββββββββββ
β
βΌ
ββββββββββββββββββ
β LLM Agent β
β step() loop β
ββββββββββββββββββ
How Skills Work#
System prompt includes a lightweight index of all enabled skills (name + description, ~30 tokens each). Skills marked
always: truehave their full body injected.When the model encounters a relevant task, it calls
skill_view(skill_id)to load the complete instructions.The model follows those instructions using its existing tools (
code_executor,web_search,file_system, etc.).All results flow through standard
role: toolmessages β no special routing, no short-circuiting.
Three-Level Progressive Disclosure#
Level |
Content |
Cost |
Source |
|---|---|---|---|
L1 |
Name + one-line description |
~30 tokens/skill |
System prompt (automatic) |
L2 |
Full SKILL.md body |
On demand |
|
L3 |
Referenced scripts, templates, docs |
On demand |
|
Key Features#
Skill as Knowledge: Skills guide the model; execution uses existing tools. No separate pipeline, no subprocess isolation needed.
Unified Tool Integration: Skill tools (
skills_list,skill_view,skill_manage) are registered through the standardToolManageralongside MCP and built-in tools.Multi-Source Loading: Load skills from local directories, ModelScope repositories, or Git URLs via
SkillCatalog.Three-Tier Priority: Built-in skills < user home skills < workspace skills. Same-name skills at higher tiers override lower ones.
Always-Active Skills: Mark critical skills with
always: trueto inject their full content into the system prompt.Hot Reload:
SkillCatalogsupports reloading individual skills or full refresh. Changes are immediately visible via tool calls.Runtime Self-Evolution: When
enable_manage: true, the model can create, edit, and delete skills during a conversation.Zero Overhead When Disabled: No
skills:config β no skill tools registered, no prompt injection, no performance impact.
Skill Directory Structure#
my-skill/
βββ SKILL.md # Required: entry point
βββ scripts/ # Optional: executable scripts
β βββ search.py
βββ references/ # Optional: reference documents
β βββ api-docs.md
βββ templates/ # Optional: template files
β βββ report.html
βββ assets/ # Optional: static resources
βββ config.yaml
SKILL.md Format#
---
name: paper-finder # required, hyphen-case, β€64 chars
description: "Search academic papers" # required, β€1024 chars
version: "1.0.0" # optional
author: "team-name" # optional
tags: [research, papers] # optional, for filtering
always: false # optional, true β full body in prompt
requires: # optional, dependency declaration
tools: [web_search, terminal]
env: [ARXIV_API_KEY]
---
# Paper Finder
## When to Use
Use this skill when asked to find or analyze academic papers.
## Steps
1. Search arXiv using `web_search`
2. Parse results with `code_executor`
3. Summarize findings for the user
Quick Start#
Using LLMAgent#
import asyncio
from omegaconf import DictConfig
from ms_agent.agent import LLMAgent
config = DictConfig({
'llm': {
'model': 'qwen-max',
'api_base': 'https://dashscope.aliyuncs.com/compatible-mode/v1',
},
'tools': {
'code_executor': {'implementation': 'python_env'},
},
'skills': {
'path': ['./skills'],
'auto_discover': True,
},
})
agent = LLMAgent(config, tag='skill-agent')
async def main():
result = await agent.run('Search for papers on multi-modal RAG')
print(result[-1].content)
asyncio.run(main())
Programmatic Usage#
from ms_agent.skill import SkillCatalog, SkillPromptInjector, SkillToolSet
catalog = SkillCatalog()
catalog.load_from_config(skills_config)
injector = SkillPromptInjector(catalog)
prompt_section = injector.build_skill_prompt_section()
toolset = SkillToolSet(config, catalog, enable_manage=True)
Configuration#
# agent.yaml
skills:
# Source paths (local dirs, ModelScope repos, or mixed)
path:
- ./skills
- ms-agent/research_skills
# Or structured sources
sources:
- type: local
path: ./skills
- type: modelscope
repo_id: ms-agent/research_skills
revision: v1.0
auto_discover: true # scan CWD/skills/ automatically
enable_manage: false # enable skill_manage tool
# Filtering (three-value semantics)
# whitelist: null # null = all enabled (default)
# whitelist: [] # [] = all disabled
# whitelist: [paper-finder] # specific skills only
disabled: [] # disable specific skills
Core Components#
Component |
Description |
|---|---|
|
Multi-source skill loader with priority-based override, caching, whitelist/disabled filtering, and hot reload |
|
Builds the skill section for system prompt injection (always-skill bodies + summary index) |
|
|
|
Low-level disk parser for SKILL.md directories (preserved from v1) |
|
Data model for a parsed skill (preserved from v1) |
Comparison with Previous Version (v1)#
Aspect |
v1 (AutoSkills pipeline) |
v2 (Knowledge + Tools) |
|---|---|---|
Execution |
Separate pipeline: LLM analysis β DAG β subprocess |
Standard agent loop β model uses tools directly |
Dispatch |
|
No special branch; skills are standard tools |
Context |
4-level LLM-driven progressive analysis |
3-level disclosure: prompt β |
Tool coexistence |
Skills and MCP tools mutually exclusive |
All tools coexist in same loop |
Streaming |
Not supported in skill mode |
Naturally supported |
Dependencies |
FAISS, Docker, sentence-transformers |
None (pure Python) |
Removed |
|
β |
Added |
β |
|