Python: Explicitly emit available_resources and available_scripts in skill content#6694
Merged
Merged
Conversation
…skill content Skill content now always emits <available_resources> and <available_scripts> blocks, using self-closing elements when empty, so models receive an authoritative list per category and do not hallucinate resource/script names. FileSkill now also emits its resources block. Closes microsoft#6348 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the Python Skills content builders so skill content always includes authoritative available_resources and available_scripts listings (or explicit emptiness), reducing the chance that models hallucinate non-existent resources/scripts when using the Skills feature.
Changes:
- Replace conditional
<resources>/<scripts>emission with always-emitted<available_resources>/<available_scripts>blocks (self-closing when empty) forInlineSkillandClassSkill. - Update
FileSkill.get_content()to always append both blocks and to include resources (previously it only appended scripts, and only when present). - Update/extend unit tests to validate the renamed tags and empty/self-closing block behavior, including new FileSkill resources coverage.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| python/packages/core/agent_framework/_skills.py | Centralizes and standardizes skill-content emission of <available_resources> / <available_scripts> blocks across Inline/Class/File skills, including empty/self-closing behavior. |
| python/packages/core/tests/core/test_skills.py | Updates assertions and adds coverage for always-emitted/renamed blocks and FileSkill resources emission. |
Contributor
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
SergeyMenshykh
approved these changes
Jun 24, 2026
eavanvalkenburg
approved these changes
Jun 24, 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.
Motivation & Context
When a skill has no resources or scripts, the Python skill-content builders left those sections out of the generated content entirely. With nothing saying "there are none", a model can assume resources/scripts exist and hallucinate calls to names that aren't there. This ports .NET PR #6672 to Python so skill content always advertises an authoritative list (or explicit emptiness) for each category.
Description & Review Guide
<available_resources>and<available_scripts>blocks — listing entries by name when present, or a self-closing element (<available_resources />/<available_scripts />) when empty. The blocks were renamed from<resources>/<scripts>. Two shared helpers (_build_available_resources_block/_build_available_scripts_block) centralize the logic, used byInlineSkill/ClassSkill(via_build_skill_content) andFileSkill.FileSkillnow also emits its resources block, which it previously never did. Builder docstrings and unit tests were updated, with new tests for the empty-block and FileSkill-resources cases.FileSkillresources emission.Related Issue
Closes #6348
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.