Python: [BREAKING] Support code-defined agent skills#4387
Merged
SergeyMenshykh merged 10 commits intomicrosoft:mainfrom Mar 4, 2026
Merged
Python: [BREAKING] Support code-defined agent skills#4387SergeyMenshykh merged 10 commits intomicrosoft:mainfrom
SergeyMenshykh merged 10 commits intomicrosoft:mainfrom
Conversation
Member
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Python support for code-defined agent skills, enabling skills to be declared in code (with optional dynamic resources) alongside existing file-based SKILL.md discovery.
Changes:
- Refactors skills support into
agent_framework._skillspackage with newAgentSkill,AgentSkillResource, andAgentSkillsProvider. - Extends the skills provider to register code-defined skills and expose dynamic resources via
@skill.resource. - Updates samples and expands core test coverage to include code-defined skills and combined scenarios.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| python/packages/core/agent_framework/_skills/_agent_skills_provider.py | New unified provider for file-based + code-defined skills, discovery helpers, prompt/tool wiring. |
| python/packages/core/agent_framework/_skills/_models.py | Introduces AgentSkill / AgentSkillResource models and @skill.resource decorator support. |
| python/packages/core/agent_framework/_skills/init.py | Exposes the new public skills API from the package. |
| python/packages/core/agent_framework/init.py | Updates public exports to the new skills API and removes the old provider export. |
| python/packages/core/tests/core/test_skills.py | Expands tests to cover code-defined skills, combined scenarios, formatting, discovery, and validation. |
| python/samples/02-agents/skills/basic_skill/basic_skill.py | Updates sample to use AgentSkillsProvider instead of the old provider. |
| python/samples/02-agents/skills/basic_skill/README.md | Fixes sample structure/run command and updates provider naming. |
| python/samples/02-agents/skills/code_skill/code_skill.py | Adds new sample demonstrating code-defined skills and dynamic resources. |
| python/samples/02-agents/skills/code_skill/README.md | Documents the new code-defined skills sample. |
| python/packages/core/agent_framework/_skills.py | Removes the legacy monolithic skills module in favor of the package layout. |
python/packages/core/agent_framework/_skills/_agent_skills_provider.py
Outdated
Show resolved
Hide resolved
python/packages/core/agent_framework/_skills/_agent_skills_provider.py
Outdated
Show resolved
Hide resolved
python/packages/core/agent_framework/_skills/_agent_skills_provider.py
Outdated
Show resolved
Hide resolved
python/packages/core/agent_framework/_skills/_agent_skills_provider.py
Outdated
Show resolved
Hide resolved
python/packages/core/agent_framework/_skills/_agent_skills_provider.py
Outdated
Show resolved
Hide resolved
python/packages/core/agent_framework/_skills/_agent_skills_provider.py
Outdated
Show resolved
Hide resolved
python/packages/core/agent_framework/_skills/_agent_skills_provider.py
Outdated
Show resolved
Hide resolved
python/packages/core/agent_framework/_skills/_agent_skills_provider.py
Outdated
Show resolved
Hide resolved
python/packages/core/agent_framework/_skills/_agent_skills_provider.py
Outdated
Show resolved
Hide resolved
TaoChenOSU
reviewed
Mar 2, 2026
TaoChenOSU
reviewed
Mar 2, 2026
4 tasks
TaoChenOSU
approved these changes
Mar 3, 2026
dmytrostruk
approved these changes
Mar 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for code-defined agent skills — skills defined entirely in Python code using
AgentSkillandAgentSkillResourceclasses, complementing the existing file-basedSKILL.mdapproach.Changes
Core (
packages/core/agent_framework/_skills/)_skills.pymodule into a_skills/package:_models.py—AgentSkillandAgentSkillResourcedata model classes_agent_skills_provider.py—AgentSkillsProvider(renamed fromFileAgentSkillsProvider) supporting both file-based and code-defined skills__init__.py— public API exportsAgentSkillsProvidernow accepts askillsparameter for code-definedAgentSkillinstancesAgentSkill.resourcedecorator for attaching dynamic callable resourcesSamples
code_skillsample demonstrating two patterns:@skill.resourcedecoratorbasic_skill/README.mdincorrect directory/file namesbasic_skill/basic_skill.pyExample 2 to be genuinely multi-turnTests
Related Issues