mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
1d301af7d2
* Add MCP-based skills support - Add AgentMcpSkill, AgentMcpSkillResource, AgentMcpSkillsSource, and McpSkillIndex to Microsoft.Agents.AI.Mcp - Add AgentSkillsProviderBuilderMcpExtensions for DI integration - Add Agent_Step06_McpBasedSkills sample project - Add unit tests for AgentMcpSkillsSource - Update solution file and project references Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Remove unnecessary [Experimental] attributes from MCP package The package is already alpha, so the [Experimental] attribute is redundant. Removed from both AgentSkillsProviderBuilderMcpExtensions and AgentMcpSkillsSource classes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Make Agent_Step06_McpBasedSkills self-contained and add to verify-samples Embed an internal MCP server (launched via --server flag as a child process) that serves skill://index.json and skill://unit-converter/SKILL.md resources, replacing the external MCP_SKILLS_ENDPOINT dependency. The sample now uses StdioClientTransport and a fixed prompt instead of an interactive loop. Added SampleDefinition to AgentsSamples.cs for automated verification. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sort usings --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1d301af7d2
·
2026-05-27 18:38:57 +00:00
History
AgentSkills Samples
Samples demonstrating Agent Skills capabilities. Each sample shows a different way to define and use skills.
| Sample | Description |
|---|---|
| Agent_Step01_FileBasedSkills | Define skills as SKILL.md files on disk with reference documents. Uses a unit-converter skill. |
| Agent_Step02_CodeDefinedSkills | Define skills entirely in C# code using AgentInlineSkill, with static/dynamic resources and scripts. |
| Agent_Step03_ClassBasedSkills | Define skills as C# classes using AgentClassSkill. |
| Agent_Step04_MixedSkills | (Advanced) Combine file-based, code-defined, and class-based skills using AgentSkillsProviderBuilder. |
| Agent_Step05_SkillsWithDI | Use Dependency Injection with both code-defined (AgentInlineSkill) and class-based (AgentClassSkill) skills. |
| Agent_Step06_McpBasedSkills | Discover skills served over the Model Context Protocol (MCP) via AgentMcpSkillsSource. Spins up an in-process MCP server that exposes skills as resources (skill://...) and connects an McpClient to it. |
Key Concepts
Skill Types
| Aspect | File-Based | Code-Defined | Class-Based |
|---|---|---|---|
| Definition | SKILL.md files on disk |
AgentInlineSkill instances in C# |
Classes extending AgentClassSkill |
| Resources | All files in skill directory (filtered by extension) | AddResource (static value or delegate-backed) |
CreateResource factory methods |
| Scripts | Supported via script runner delegate | AddScript delegates |
CreateScript factory methods |
| Discovery | Automatic from directory path | Explicit via constructor | Explicit via constructor |
| Dynamic content | No (static files only) | Yes (factory delegates) | Yes (factory delegates) |
| Sharing pattern | Copy skill directory | Inline or shared instances | Package in shared assemblies/NuGet |
| DI support | No | Yes (via IServiceProvider parameter) |
Yes (via IServiceProvider parameter) |
AgentSkillsProvider vs AgentSkillsProviderBuilder
For single-source scenarios, use the AgentSkillsProvider constructors directly — they accept a skill directory path, a set of skills, or a custom source.
Use AgentSkillsProviderBuilder for advanced scenarios where simple constructors are insufficient:
- Mixed skill types — combine file-based, code-defined, and class-based skills in one provider
- Multiple file script runners — use different script runners for different file skill directories
- Skill filtering — include or exclude skills using a predicate
See Agent_Step04_MixedSkills for a working example.