-
Notifications
You must be signed in to change notification settings - Fork 2.1k
.NET: Add AgentSkillsSourceContext to AgentSkillsSource.GetSkillsAsync #6797
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
SergeyMenshykh
merged 3 commits into
microsoft:main
from
SergeyMenshykh:sergeymenshykh-add-agent-skills-source-context
Jun 30, 2026
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
dotnet/src/Microsoft.Agents.AI/Skills/AgentSkillFilterContext.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| // Copyright (c) Microsoft. All rights reserved. | ||
|
|
||
| using System.Diagnostics.CodeAnalysis; | ||
| using Microsoft.Shared.DiagnosticIds; | ||
| using Microsoft.Shared.Diagnostics; | ||
|
|
||
| namespace Microsoft.Agents.AI; | ||
|
|
||
| /// <summary> | ||
| /// Provides contextual information to a skill filter predicate. | ||
| /// </summary> | ||
| [Experimental(DiagnosticIds.Experiments.AgentsAIExperiments)] | ||
| public sealed class AgentSkillFilterContext | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="AgentSkillFilterContext"/> class. | ||
| /// </summary> | ||
| /// <param name="skill">The skill being evaluated by the filter.</param> | ||
| /// <param name="skillsSourceContext">Contextual information about the agent and session requesting skills.</param> | ||
| internal AgentSkillFilterContext(AgentSkill skill, AgentSkillsSourceContext skillsSourceContext) | ||
| { | ||
| this.Skill = Throw.IfNull(skill); | ||
| this.SkillsSourceContext = Throw.IfNull(skillsSourceContext); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets the skill being evaluated by the filter. | ||
| /// </summary> | ||
| public AgentSkill Skill { get; } | ||
|
|
||
| /// <summary> | ||
| /// Gets contextual information about the agent and session requesting skills. | ||
| /// </summary> | ||
| public AgentSkillsSourceContext SkillsSourceContext { get; } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
dotnet/src/Microsoft.Agents.AI/Skills/AgentSkillsSourceContext.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| // Copyright (c) Microsoft. All rights reserved. | ||
|
|
||
| using System.Diagnostics.CodeAnalysis; | ||
| using Microsoft.Shared.DiagnosticIds; | ||
| using Microsoft.Shared.Diagnostics; | ||
|
|
||
| namespace Microsoft.Agents.AI; | ||
|
|
||
| /// <summary> | ||
| /// Provides contextual information about the agent and session to an <see cref="AgentSkillsSource"/> | ||
| /// when retrieving skills. | ||
| /// </summary> | ||
| [Experimental(DiagnosticIds.Experiments.AgentsAIExperiments)] | ||
| public sealed class AgentSkillsSourceContext | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="AgentSkillsSourceContext"/> class. | ||
| /// </summary> | ||
| /// <param name="agent">The agent requesting skills.</param> | ||
| /// <param name="session">The session associated with the agent invocation, if any.</param> | ||
| internal AgentSkillsSourceContext(AIAgent agent, AgentSession? session) | ||
| { | ||
| this.Agent = Throw.IfNull(agent); | ||
| this.Session = session; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets the agent requesting skills. | ||
| /// </summary> | ||
| public AIAgent Agent { get; } | ||
|
|
||
| /// <summary> | ||
| /// Gets the session associated with the agent invocation, if any. | ||
| /// </summary> | ||
| public AgentSession? Session { get; } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
dotnet/src/Microsoft.Agents.AI/Skills/Decorators/CachingAgentSkillsSourceOptions.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| // Copyright (c) Microsoft. All rights reserved. | ||
|
|
||
| using System; | ||
| using System.Diagnostics.CodeAnalysis; | ||
| using Microsoft.Shared.DiagnosticIds; | ||
|
|
||
| namespace Microsoft.Agents.AI; | ||
|
|
||
| /// <summary> | ||
| /// Options for configuring <see cref="CachingAgentSkillsSource"/>. | ||
| /// </summary> | ||
| [Experimental(DiagnosticIds.Experiments.AgentsAIExperiments)] | ||
| public sealed class CachingAgentSkillsSourceOptions | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets a delegate that returns the cache isolation key for a skills source invocation. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// When this delegate is <see langword="null"/>, or when it returns <see langword="null"/>, | ||
| /// the skills are stored in the shared cache bucket. When it returns a non-null string, | ||
| /// the skills are cached under that key. | ||
| /// </remarks> | ||
|
SergeyMenshykh marked this conversation as resolved.
|
||
| public Func<AgentSkillsSourceContext, string?>? CacheIsolationKeySelector { get; set; } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.