Python: Support skill scripts execution#4558
Open
SergeyMenshykh wants to merge 17 commits intomicrosoft:mainfrom
Open
Python: Support skill scripts execution#4558SergeyMenshykh wants to merge 17 commits intomicrosoft:mainfrom
SergeyMenshykh wants to merge 17 commits intomicrosoft:mainfrom
Conversation
Member
Contributor
There was a problem hiding this comment.
Pull request overview
Adds first-class support for executing skill scripts in the Python agent framework, covering both file-based scripts (delegated to a configurable executor) and code-defined scripts (registered via a decorator and executed in-process). This extends the existing SkillsProvider progressive-disclosure model to include script execution and introduces new samples demonstrating file skills, mixed skills, and human approval gating.
Changes:
- Core: add
SkillScript,@skill.script, script discovery, and anexecute_skill_scripttool with optional approval gating. - Public API: export new script-related types from
agent_framework.__init__. - Ecosystem: add/refresh samples for file skills, code-defined skills, mixed skills, and script approval; expand test coverage for script behavior.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| python/packages/core/agent_framework/_skills.py | Adds script model/executor APIs, script discovery, prompt/tool wiring, and runtime execution path. |
| python/packages/core/agent_framework/init.py | Exports new public script-related types. |
| python/packages/core/tests/core/test_skills.py | Adds extensive tests for script discovery/execution, approval mode, and edge cases. |
| python/packages/core/AGENTS.md | Updates package layout docs to include the skills module. |
| python/samples/02-agents/skills/subprocess_script_runner.py | Adds a shared subprocess-based file-script runner callback for samples. |
| python/samples/02-agents/skills/README.md | Adds a top-level index README for the skills learning path and concepts. |
| python/samples/02-agents/skills/file_based_skill/file_based_skill.py | New file-based skill sample demonstrating script execution via callback executor. |
| python/samples/02-agents/skills/file_based_skill/README.md | Documentation for running and understanding the file-based skill sample. |
| python/samples/02-agents/skills/file_based_skill/skills/password-generator/SKILL.md | Adds a file-based skill definition that references a script. |
| python/samples/02-agents/skills/file_based_skill/skills/password-generator/references/PASSWORD_GUIDELINES.md | Adds reference guidelines for the password-generator file skill. |
| python/samples/02-agents/skills/file_based_skill/skills/password-generator/scripts/generate.py | Adds the executable password generator script used by the file-based sample. |
| python/samples/02-agents/skills/mixed_skills/mixed_skills.py | New mixed sample combining code-defined scripts/resources with a file-based scripted skill. |
| python/samples/02-agents/skills/mixed_skills/README.md | Documentation for the mixed skills sample and how it wires both skill types. |
| python/samples/02-agents/skills/mixed_skills/skills/password-generator/SKILL.md | Adds a file-based password-generator skill used by the mixed sample. |
| python/samples/02-agents/skills/mixed_skills/skills/password-generator/references/PASSWORD_GUIDELINES.md | Adds reference guidelines for the mixed-sample password-generator skill. |
| python/samples/02-agents/skills/mixed_skills/skills/password-generator/scripts/generate.py | Adds the password generator script used by the mixed sample. |
| python/samples/02-agents/skills/script_approval/script_approval.py | New sample showing how to require human approval before executing scripts. |
| python/samples/02-agents/skills/script_approval/README.md | Documentation for the script approval workflow sample. |
| python/samples/02-agents/skills/code_skill/code_skill.py | Removes/renames the older code skill sample in favor of the new code-defined-skill sample. |
| python/samples/02-agents/skills/code_skill/README.md | Removes the older code skill sample README. |
| python/samples/02-agents/skills/code_defined_skill/code_defined_skill.py | Adds the updated code-defined skill sample including @skill.script. |
| python/samples/02-agents/skills/code_defined_skill/README.md | Documentation for the code-defined skill sample. |
| python/samples/02-agents/skills/basic_skill/basic_skill.py | Removes the older “basic_skill” sample. |
| python/samples/02-agents/skills/basic_skill/README.md | Removes the older “basic_skill” README. |
| python/samples/02-agents/skills/basic_skill/skills/expense-report/SKILL.md | Removes the older expense-report file skill. |
| python/samples/02-agents/skills/basic_skill/skills/expense-report/references/POLICY_FAQ.md | Removes the older expense-report FAQ resource. |
| python/samples/02-agents/skills/basic_skill/skills/expense-report/assets/expense-report-template.md | Removes the older expense-report template asset. |
python/samples/02-agents/skills/file_based_skill/skills/password-generator/scripts/generate.py
Outdated
Show resolved
Hide resolved
python/samples/02-agents/skills/code_defined_skill/code_defined_skill.py
Outdated
Show resolved
Hide resolved
TaoChenOSU
reviewed
Mar 9, 2026
python/samples/02-agents/skills/code_defined_skill/code_defined_skill.py
Show resolved
Hide resolved
.../samples/02-agents/skills/mixed_skills/skills/unit-converter/references/CONVERSION_TABLES.md
Show resolved
Hide resolved
...ples/02-agents/skills/file_based_skill/skills/unit-converter/references/CONVERSION_TABLES.md
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…n every call when the result was None 2. Updating the arguments tool description to be more generic (not CLI-specific)
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 executing agent skill scripts — both file-based scripts (delegated to a
SkillScriptRunner) and code-defined scripts (registered via the@skill.scriptdecorator and executed in-process).Changes
Core (
packages/core/agent_framework/_skills.py)SkillScriptmodel with optionalfunction(code-based) andpath(file-based) fieldsSkillScriptRunnerprotocol for file-based script execution strategiesrun_skill_scripttool with optional user-approval gate (require_script_approval)Skillmodel with mutablescriptslist@skill.scriptdecorator for registering code-defined scriptsExports (
__init__.py)SkillScript,SkillScriptRunnerTests (
tests/core/test_skills.py)Samples
file_based_skill,code_defined_skill,mixed_skills,script_approval)subprocess_script_runner.pyutility for file-based script execution via subprocessDesign Decisions
SkillScriptRunner— the framework does not assume a specific execution strategy (subprocess, sandbox, hosted interpreter, etc.)run_skill_scripttool supports an optional approval gate for safetyCloses: #4349