Python: [BREAKING] Support code-defined agent skills (#4387)

* support code skills

* address pr review comments

* address package and syntax checks

* address pr review comments

* address pr review comment

* address failed check

* rename agentskill and agetnskillprovider

* move agent skills related assets to _skills.py

* address pr review comments

* address review comments
This commit is contained in:
SergeyMenshykh
2026-03-04 18:36:02 +00:00
committed by GitHub
parent 5fb0cc106a
commit 4dad26fcae
7 changed files with 2323 additions and 652 deletions
@@ -1,6 +1,6 @@
# Agent Skills Sample
This sample demonstrates how to use **Agent Skills** with a `FileAgentSkillsProvider` in the Microsoft Agent Framework.
This sample demonstrates how to use **Agent Skills** with a `SkillsProvider` in the Microsoft Agent Framework.
## What are Agent Skills?
@@ -20,8 +20,8 @@ Policy-based expense filing with spending limits, receipt requirements, and appr
## Project Structure
```
basic_skills/
├── basic_file_skills.py
basic_skill/
├── basic_skill.py
├── README.md
└── skills/
└── expense-report/
@@ -52,7 +52,7 @@ This sample uses `AzureCliCredential` for authentication. Run `az login` in your
```bash
cd python
uv run samples/02-agents/skills/basic_skills/basic_file_skills.py
uv run samples/02-agents/skills/basic_skill/basic_skill.py
```
### Examples
@@ -4,18 +4,15 @@ import asyncio
import os
from pathlib import Path
from agent_framework import Agent, FileAgentSkillsProvider
from agent_framework import Agent, SkillsProvider
from agent_framework.azure import AzureOpenAIResponsesClient
from azure.identity import AzureCliCredential
from dotenv import load_dotenv
# Load environment variables from .env file
load_dotenv()
"""
Agent Skills Sample
This sample demonstrates how to use file-based Agent Skills with a FileAgentSkillsProvider.
This sample demonstrates how to use file-based Agent Skills with a SkillsProvider.
Agent Skills are modular packages of instructions and resources that extend an agent's
capabilities. They follow the progressive disclosure pattern:
@@ -27,6 +24,9 @@ This sample includes the expense-report skill:
- Policy-based expense filing with references and assets
"""
# Load environment variables from .env file
load_dotenv()
async def main() -> None:
"""Run the Agent Skills demo."""
@@ -44,7 +44,7 @@ async def main() -> None:
# --- 2. Create the skills provider ---
# Discovers skills from the 'skills' directory and makes them available to the agent
skills_dir = Path(__file__).parent / "skills"
skills_provider = FileAgentSkillsProvider(skill_paths=str(skills_dir))
skills_provider = SkillsProvider(skill_paths=str(skills_dir))
# --- 3. Create the agent with skills ---
async with Agent(