Skip to content

Python: Fix read_skill_resource instruction dropping .md extension#7031

Merged
giles17 merged 1 commit into
microsoft:mainfrom
giles17:fix-skill-resource-instructions
Jul 10, 2026
Merged

Python: Fix read_skill_resource instruction dropping .md extension#7031
giles17 merged 1 commit into
microsoft:mainfrom
giles17:fix-skill-resource-instructions

Conversation

@giles17

@giles17 giles17 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Motivation & Context

Microsoft Agent Framework Skills expose a read_skill_resource tool that resolves resources by their exact listed name. For file-based skills, resource names include their relative path and file extension (e.g. references/output-schema.md), and the <available_resources> block advertises them that way. Lookup (get_resource) matches on that exact name.

However, the generated RESOURCE_INSTRUCTIONS prompt contained a misleading example that told the model to strip the extension:

Use read_skill_resource ... (e.g. "style-guide" not "style-guide.md", "references/FAQ" not "FAQ.md").

The second example (references/FAQ instead of references/FAQ.md) demonstrates dropping the .md extension, which directly contradicts the exact-match behavior. This nudges the model into calling read_skill_resource(resource_name="references/output-schema"), which then fails with Resource '...' not found in skill '...'.

This is a Python-only transcription defect: the .NET original (AgentSkillsProvider.cs) correctly reads "references/FAQ.md" not "FAQ.md".

Description & Review Guide

  • What are the major changes? A one-line fix to the RESOURCE_INSTRUCTIONS example in python/packages/core/agent_framework/_skills.py: "references/FAQ" -> "references/FAQ.md", restoring exact parity with the .NET prompt. The unifying rule ("use the name exactly as listed") is unchanged; the file-resource example now keeps its extension.
  • What is the impact of these changes? Agents following the instruction now call read_skill_resource with the full listed name (including .md), so resource loading no longer fails. Prompt-text only; no API or behavioral code changes.
  • What do you want reviewers to focus on? Confirm the corrected example matches how file resources are named/advertised and looked up.

Related Issue

Fixes #7008

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.

The RESOURCE_INSTRUCTIONS example told the model to use

eferences/FAQ instead of 
eferences/FAQ.md, contradicting the
actual exact-match resource lookup (which lists and matches names
including the extension). This caused read_skill_resource to fail with
'Resource not found'. Align the example with the .NET original.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 9, 2026 22:40
@giles17 giles17 added the python Usage: [Issues, PRs], Target: Python label Jul 9, 2026
@giles17 giles17 marked this pull request as ready for review July 9, 2026 22:41

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

This PR fixes a misleading example in the Python skills system prompt (RESOURCE_INSTRUCTIONS) so that read_skill_resource is called with the exact resource name as listed in <available_resources>, including the .md extension for file-based resources (aligning Python with the .NET prompt).

Changes:

  • Update the RESOURCE_INSTRUCTIONS example from references/FAQ to references/FAQ.md to match exact-name lookup behavior.
  • Preserve the existing rule text (“use the name exactly as listed”) while correcting the file-resource example that previously contradicted lookup semantics.

@giles17 giles17 enabled auto-merge July 9, 2026 22:42

@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: 96% | Result: All clear

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


Automated review by giles17's agents

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/core/agent_framework
   _skills.py10833996%314, 584, 1102, 1117, 1119–1120, 1486–1487, 1729, 1758, 2252, 2441, 2949–2950, 3047, 3055, 3060, 3063, 3068, 3088, 3100, 3105, 3200, 3208, 3213, 3216, 3221, 3241, 3250, 3255, 3521–3522, 4074, 4322–4323, 4350–4351, 4358–4359
TOTAL44098527088% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
8833 33 💤 0 ❌ 0 🔥 2m 10s ⏱️

@giles17 giles17 added this pull request to the merge queue Jul 10, 2026
Merged via the queue into microsoft:main with commit e6cc2c0 Jul 10, 2026
43 of 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: [Bug]: read_skill_resource removes .md extension from resource name, causing resource loading failure

4 participants