Skip to content

[dotnet-port-api] Port skills source context from .NET #440

Description

@github-actions

Summary

Port the .NET skills-source context change from microsoft/agent-framework#6797 so Go skill sources and provider-level filters can receive invocation-aware context.

This updates the public agent/skills source API to pass a new skills.SourceContext containing the current agent and session, threads that context through skills.NewContextProvider, and adds CacheIsolationKeySelector so cached skill discovery can be isolated per context when needed while preserving the existing shared-cache default. File-based sources were updated to the new signature, the affected skills tests were updated, and the feature comparison doc now reflects the new invocation-aware skills support.

Upstream commit: microsoft/agent-framework@09fbccf

Ported .NET PRs

Breaking Changes

Yes.

Old behavior/API:

  • skills.Source and skills.SourceFunc exposed Skills(context.Context) ([]*skills.Skill, error).
  • skills.ContextProviderOptions.SkillFilter accepted func(*skills.Skill) bool.
  • Skills provider caching was always shared across invocations unless disabled entirely.

New behavior/API:

  • skills.Source and skills.SourceFunc now expose Skills(context.Context, skills.SourceContext) ([]*skills.Skill, error).
  • skills.ContextProviderOptions.SkillFilter now accepts func(*skills.Skill, skills.SourceContext) bool.
  • skills.ContextProviderOptions.CacheIsolationKeySelector can opt specific invocations into isolated cache buckets while keeping the default shared-cache behavior.

This breaking change is acceptable for the beta Go SDK because it directly aligns the public skills extension surface with upstream .NET and enables context-aware skill discovery/filtering without redesigning the broader agent lifecycle.

Tests and Examples

  • Ran go test ./agent/skills/....
  • Ran go test ./....
  • Added provider coverage for source-context propagation and cache-isolation behavior.
  • Updated existing in-memory and file-based skills tests for the new source method signature.
  • No examples changed; this port updates the underlying public skills extension API rather than an end-user scenario.

Notes

Generated by .NET to Go API Porting Agent · 1.3K AIC · ⌖ 42.8 AIC · ⊞ 21.7K ·


Note

This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch dotnet-port-api-skills-source-context-20260707-ecc3c8b630fbd621.

Click here to create the pull request

To fix the permissions issue, go to SettingsActionsGeneral and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ

Show patch preview (500 of 888 lines)
From 9c3ec1aa2439dee1aafca1efe9f77ec7813cca9b Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Tue, 7 Jul 2026 06:47:03 +0000
Subject: [PATCH] [dotnet-port-api] Port skills source context from .NET

Port .NET skills-source invocation context from microsoft/agent-framework#6797 by threading agent/session metadata through Go skills sources and filters, and by adding cache isolation options for per-context caching.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 agent/skills/frontmatter_source_test.go     |   2 +-
 agent/skills/fsskills/source.go             |   2 +-
 agent/skills/fsskills/source_script_test.go |  38 +++---
 agent/skills/fsskills/source_test.go        |  43 ++++---
 agent/skills/provider.go                    | 107 +++++++++++-----
 agent/skills/provider_test.go               | 134 +++++++++++++++++++-
 agent/skills/skills.go                      |  19 ++-
 docs/dotnet-go-sdk-feature-comparison.md    |   2 +-
 8 files changed, 263 insertions(+), 84 deletions(-)

diff --git a/agent/skills/frontmatter_source_test.go b/agent/skills/frontmatter_source_test.go
index 080169ceb..bef33b763 100644
--- a/agent/skills/frontmatter_source_test.go
+++ b/agent/skills/frontmatter_source_test.go
@@ -106,7 +106,7 @@ func TestInMemorySource_ValidSkills_ReturnsAll(t *testing.T) {
 		mustInlineSkill(skills.Frontmatter{Name: "another", Description: "Another valid skill."}, "More instructions.", nil, nil),
 	)
 
-	result, err := source.Skills(t.Context())
+	result, err := source.Skills(t.Context(), skills.SourceContext{})
 	if err != nil {
 		t.Fatal(err)
 	}
diff --git a/agent/skills/fsskills/source.go b/agent/skills/fsskills/source.go
index e3f30a12e..b0dab1cb2 100644
--- a/agent/skills/fsskills/source.go
+++ b/agent/skills/fsskills/source.go
@@ -156,7 +156,7 @@ func NewSourceOptions(opts SourceOptions, filesystems ...fs.FS) *Source {
 }
 
 // Skills discovers and loads valid skills from th
... (truncated)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions