Skip to content

Python: Explicitly emit available_resources and available_scripts in skill content#6694

Merged
giles17 merged 1 commit into
microsoft:mainfrom
giles17:skills-available-blocks
Jun 24, 2026
Merged

Python: Explicitly emit available_resources and available_scripts in skill content#6694
giles17 merged 1 commit into
microsoft:mainfrom
giles17:skills-available-blocks

Conversation

@giles17

@giles17 giles17 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

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

  • What are the major changes? Skill content now always emits <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 by InlineSkill/ClassSkill (via _build_skill_content) and FileSkill. FileSkill now 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.
  • What is the impact of these changes? The generated skill-content text changes (the two blocks are now always present and renamed). No public API is removed; the Skills feature remains experimental.
  • What do you want reviewers to focus on? The renamed/always-emitted blocks and the new FileSkill resources emission.

Related Issue

Closes #6348

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

…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>
Copilot AI review requested due to automatic review settings June 23, 2026 23:46
@moonbox3 moonbox3 added the python Usage: [Issues, PRs], Target: Python label Jun 23, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) for InlineSkill and ClassSkill.
  • 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.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated Code Review

Reviewers: 5 | Confidence: 81% | Result: All clear

Reviewed: Correctness, Security Reliability, Test Coverage, Failure Modes, Design Approach


Automated review by giles17's agents

@github-actions

Copy link
Copy Markdown
Contributor

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/core/agent_framework
   _skills.py10263796%294, 541, 1054, 1069, 1071–1072, 1432–1433, 1445–1446, 1678, 1707, 2170, 2626–2627, 2762, 2767, 2770, 2775, 2802, 2807, 2861, 2870, 2875, 2878, 2883, 2907, 2912, 3154–3155, 3504, 3731–3732, 3759–3760, 3767–3768
TOTAL42155498188% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
8303 37 💤 0 ❌ 0 🔥 2m 4s ⏱️

@giles17 giles17 marked this pull request as ready for review June 24, 2026 03:28

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated Code Review

Reviewers: 5 | Confidence: 82% | Result: All clear

Reviewed: Correctness, Security Reliability, Test Coverage, Failure Modes, Design Approach


Automated review by giles17's agents

@giles17 giles17 added this pull request to the merge queue Jun 24, 2026
Merged via the queue into microsoft:main with commit 91f639a Jun 24, 2026
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: Explicitly emit available_resources and available_scripts in skill content

5 participants