Skip to content

[dotnet-port-fixes] Align skills prompt placeholders with .NET - #392

Merged
qmuntal merged 4 commits into
mainfrom
dotnet-port-skills-prompt-placeholders-20260626034300-aaa847d41a63dd26
Jun 30, 2026
Merged

[dotnet-port-fixes] Align skills prompt placeholders with .NET#392
qmuntal merged 4 commits into
mainfrom
dotnet-port-skills-prompt-placeholders-20260626034300-aaa847d41a63dd26

Conversation

@michelle-clayton-work

Copy link
Copy Markdown
Contributor

Port upstream .NET behavior from microsoft/agent-framework#6706 so custom skills prompt templates only require the {skills} placeholder. Legacy resource and script instruction placeholders are no longer specially substituted; default guidance remains embedded in the default prompt.

Port upstream .NET behavior from microsoft/agent-framework#6706 so custom skills prompt templates only require the {skills} placeholder. Legacy resource and script instruction placeholders are no longer specially substituted; default guidance remains embedded in the default prompt.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@michelle-clayton-work
michelle-clayton-work requested a review from a team as a code owner June 29, 2026 21:45
Copilot AI review requested due to automatic review settings June 29, 2026 21:45

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

Aligns the Go agent/skills context provider’s prompt-template placeholder behavior with the upstream .NET implementation by making {skills} the only required placeholder in custom templates and embedding resource/script guidance directly in the default prompt.

Changes:

  • Remove special substitution and validation for legacy {resource_instructions} / {script_instructions} placeholders; only {skills} is required and substituted.
  • Embed resource/script usage guidance in the default skills instruction prompt instead of injecting it via placeholders.
  • Update tests to validate the new behavior (custom templates don’t receive default guidance; legacy placeholders remain literal if present).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
agent/skills/provider.go Simplifies placeholder handling to only {skills}, embeds default resource/script guidance, and updates template validation accordingly.
agent/skills/provider_test.go Updates/extends unit tests to cover acceptance of missing legacy placeholders and literal retention of legacy tokens.
agent/skills/skills_test.go Adjusts the custom prompt template test to only use {skills}.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

This comment has been minimized.

@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.

Generated by Go API Consistency Review Agent for #392 · 190.5 AIC · ⌖ 12.8 AIC · ⊞ 28.8K

Comment thread agent/skills/provider.go
…ionPrompt docstring

Co-authored-by: gdams <20224954+gdams@users.noreply.github.com>
Copilot finished work on behalf of gdams June 30, 2026 07:34
@github-actions

This comment has been minimized.

Comment thread agent/skills/provider.go Outdated
…ocstring

Co-authored-by: gdams <20224954+gdams@users.noreply.github.com>
Copilot finished work on behalf of gdams June 30, 2026 08:29
Copilot AI requested a review from gdams June 30, 2026 08:29
@qmuntal
qmuntal enabled auto-merge June 30, 2026 08:45
@qmuntal
qmuntal added this pull request to the merge queue Jun 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Cross-SDK parity review

This PR faithfully ports the .NET behavior from microsoft/agent-framework#6706. The Go implementation now aligns with .NET on the following points:

  • Custom SkillsInstructionPrompt templates only require {skills}
  • Resource and script-tool guidance is embedded as literal text in the default template ✅
  • validatePromptTemplate checks only for {skills}
  • Legacy {resource_instructions} / {script_instructions} tokens in custom templates render literally (not substituted) ✅

Parity gap to track — Python vs. Go/.NET on custom-template injection

The upstream Python implementation (python/packages/core/agent_framework/_skills.py) behaves slightly differently for custom templates:

# Python: _build_instructions calls str.format() with all three substitutions,
# so a custom template CAN reference these optional placeholders:
return template.format(
    skills="\n".join(lines),
    runner_instructions=runner_instructions or "",   # SCRIPT_RUNNER_INSTRUCTIONS constant
    resource_instructions=resource_instructions or "",  # RESOURCE_INSTRUCTIONS constant
)

Python's default template is:

{skills}
...
{resource_instructions}
{runner_instructions}

This means:

  1. A Python custom template that contains {resource_instructions} or {runner_instructions} will have those tokens filled with the standard guidance constants (not remain literal).
  2. In Go (and .NET), the equivalent tokens {resource_instructions} / {script_instructions} render literally in custom templates — they are not substituted.

Additionally, Python's active placeholder for script instructions is {runner_instructions}, while Go historically used {script_instructions}. The renaming to "legacy" in Go tests is correct for Go, but these are different names than the Python constant.

Impact: Low for most users (default template is unchanged). Users migrating custom templates across SDKs, or adopting the Python convention of referencing {resource_instructions} in a custom template, will get different runtime behavior in Go vs. Python. The gap is worth tracking as a follow-up item against the Python implementation, but is not a blocker for this .NET-tracking port.

Summary: No issues blocking this PR. The Go change correctly mirrors the merged .NET behavior. The Python parity gap on optional custom-template injection predates this PR and should be tracked separately against the Python SDK.

Generated by Go API Consistency Review Agent for #392 · 227.7 AIC · ⌖ 12.6 AIC · ⊞ 27.1K ·

Merged via the queue into main with commit 595570b Jun 30, 2026
17 checks passed
@qmuntal
qmuntal deleted the dotnet-port-skills-prompt-placeholders-20260626034300-aaa847d41a63dd26 branch June 30, 2026 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[dotnet-port-fixes] Align skills prompt placeholders with .NET

5 participants