mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
4dc35e9bb0
* Python: Support Agent Skills Add FileAgentSkillsProvider, a context provider that discovers and exposes Agent Skills from filesystem directories following the Agent Skills specification (https://agentskills.io/) progressive disclosure pattern: advertise, load, read resources. Changes: - FileAgentSkillsProvider - discovers SKILL.md files from configured directories, advertises skills via system prompt injection, and provides load_skill / read_skill_resource tools for on-demand access. - Internal helpers for skill discovery, frontmatter parsing, and secure resource reading (path traversal / symlink guards). - Unit tests covering discovery, loading, resource reading, and security scenarios. - Sample (basic_file_skills) demonstrating usage with an expense-report skill. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Python: Move skills sample to samples/02-agents/basic_skills/ Align sample directory name with .NET equivalent (Agent_Step01_BasicSkills). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix code quality checks * address pr review comment and code quality check issue * address pr review comments * move the sample to the skills folder * update readme * reame consts and use types for them * leverage pathlib for working with files * refactor the test * supply schema to functions * update readme * update sample name * address pr review comments * fix failing lint check * address failing check --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2.3 KiB
2.3 KiB
Agent Skills Sample
This sample demonstrates how to use Agent Skills with a FileAgentSkillsProvider in the Microsoft Agent Framework.
What are Agent Skills?
Agent Skills are modular packages of instructions and resources that enable AI agents to perform specialized tasks. They follow the Agent Skills specification and implement the progressive disclosure pattern:
- Advertise: Skills are advertised with name + description (~100 tokens per skill)
- Load: Full instructions are loaded on-demand via
load_skilltool - Resources: References and other files loaded via
read_skill_resourcetool
Skills Included
expense-report
Policy-based expense filing with spending limits, receipt requirements, and approval workflows.
references/POLICY_FAQ.md— Detailed expense policy Q&Aassets/expense-report-template.md— Submission template
Project Structure
basic_skills/
├── basic_file_skills.py
├── README.md
└── skills/
└── expense-report/
├── SKILL.md
├── references/
│ └── POLICY_FAQ.md
└── assets/
└── expense-report-template.md
Running the Sample
Prerequisites
- An Azure AI Foundry project with a deployed model (e.g.
gpt-4o-mini)
Environment Variables
Set the required environment variables in a .env file (see python/.env.example):
AZURE_AI_PROJECT_ENDPOINT: Your Azure AI Foundry project endpointAZURE_OPENAI_RESPONSES_DEPLOYMENT_NAME: The name of your model deployment (defaults togpt-4o-mini)
Authentication
This sample uses AzureCliCredential for authentication. Run az login in your terminal before running the sample.
Run
cd python
uv run samples/02-agents/skills/basic_skills/basic_file_skills.py
Examples
The sample runs two examples:
- Expense policy FAQ — Asks about tip reimbursement; the agent loads the expense-report skill and reads the FAQ resource
- Filing an expense report — Multi-turn conversation to draft an expense report using the template asset