Skip to content

Python: .NET: [Bug]: skills prompt causes reads of nonexistent example resources #7663

Description

@KOTerra

Description

AgentSkillsProvider injects a concrete fictional resource path into the model's system instructions:

- Use `read_skill_resource` to read any referenced resources, using the name exactly as listed
   (e.g. `"style-guide"` not `"style-guide.md"`, `"references/FAQ.md"` not `"FAQ.md"`).

In repeated .NET agent runs, the model sometimes interprets references/FAQ.md as an available resource after loading a skill, even though that skill neither references nor contains that file. It then calls read_skill_resource with the example path and receives a missing-resource error.

This occurred across unrelated skills, indicating that the framework-generated system instruction is the common primer rather than any individual SKILL.md.

Expected behavior
Framework instructions should not introduce fictional resource names. They should direct the model to:

  1. Read only resources explicitly referenced by the loaded skill.
  2. Pass the resource path exactly as written.
  3. Never infer or guess resource paths.

Steps to reproduce

  1. Configure AgentSkillsProvider with skills that enable resource support.
  2. Include a skill that does not reference or contain references/FAQ.md.
  3. Run a task that loads that skill and may benefit from supporting resources.
  4. Inspect the model's tool calls.
    Depending on model sampling, it may copy references/FAQ.md from the system prompt into a read_skill_resource call.

The model behavior is nondeterministic, but the ungrounded concrete path is deterministically included in every generated prompt when resource instructions are enabled.

Code Sample

var skillsProvider = new AgentSkillsProvider(skillsPath);

// The generated system prompt advertises the fictional path:
// references/FAQ.md

// Observed model-generated call:
// read_skill_resource(
//     skillName: "some-unrelated-skill",
//     resourceName: "references/FAQ.md")

Error Messages / Stack Traces

Error: Resource 'references/FAQ.md' not found in skill 'some-unrelated-skill'.

Package Versions

Microsoft.Agents.AI: 1.2.0

.NET Version

.NET 10

Additional Context

The same concrete example currently appears in both implementations:

  • dotnet/src/Microsoft.Agents.AI/Skills/AgentSkillsProvider.cs
  • python/packages/core/agent_framework/_skills.py

This is distinct from #7008 / #7031. Those fixed the Python example incorrectly dropping the .md extension. The remaining problem is that any concrete fictional resource name in executable model instructions can be mistaken for an actually available resource.

A safer rule-only instruction would be:

Use `read_skill_resource` only for a resource explicitly referenced by the loaded skill.
Pass its resource path exactly as written in that skill.
Never infer or guess resource paths.

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETUsage: [Issues, PRs], Target: .NetpythonUsage: [Issues, PRs], Target: PythonreproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflowtriageUsage: [Issues], Target: All issues that still need to be triaged

    Type

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions