AgentSkillsProviderBuilder Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Fluent builder for constructing an AgentSkillsProvider backed by a composite source. Intended for advanced scenarios where the simple AgentSkillsProvider constructors are insufficient.
public sealed class AgentSkillsProviderBuilder
type AgentSkillsProviderBuilder = class
Public NotInheritable Class AgentSkillsProviderBuilder
- Inheritance
-
AgentSkillsProviderBuilder
Remarks
For simple, single-source scenarios, prefer the AgentSkillsProvider constructors directly (e.g., passing a skill directory path or a set of skills). Use this builder when you need one or more of the following advanced capabilities:
- Mixed skill types — combine file-based, code-defined (AgentInlineSkill), and class-based (AgentClassSkill<TSelf>) skills in a single provider.
- Multiple file script runners — use different script runners for different file skill directories via per-source
scriptRunnerparameters on UseFileSkill(String, AgentFileSkillsSourceOptions, AgentFileSkillScriptRunner) / UseFileSkills(IEnumerable<String>, AgentFileSkillsSourceOptions, AgentFileSkillScriptRunner). - Skill filtering — include or exclude skills using a predicate via UseFilter(Func<AgentSkill,AgentSkillsSourceContext,Boolean>).
Example — combining file-based and code-defined skills:
var provider = new AgentSkillsProviderBuilder()
.UseFileSkills("/path/to/skills")
.UseSkills(myInlineSkill1, myInlineSkill2)
.UseFileScriptRunner(SubprocessScriptRunner.RunAsync)
.Build();
Constructors
| Name | Description |
|---|---|
| AgentSkillsProviderBuilder() | |
Methods
| Name | Description |
|---|---|
| Build() |
Builds the AgentSkillsProvider. |
| DisableCaching() |
Disables caching of the resolved skill list. By default, skills are fetched once and cached; calling this method causes the source pipeline to be invoked on every request. |
| UseCachingOptions(Action<CachingAgentSkillsSourceOptions>) |
Configures skill caching behavior. |
| UseFileScriptRunner(AgentFileSkillScriptRunner) |
Sets the runner for file-based skill scripts. |
| UseFileSkill(String, AgentFileSkillsSourceOptions, AgentFileSkillScriptRunner) |
Adds a file-based skill source that discovers skills from a filesystem directory. |
| UseFileSkills(IEnumerable<String>, AgentFileSkillsSourceOptions, AgentFileSkillScriptRunner) |
Adds a file-based skill source that discovers skills from multiple filesystem directories. |
| UseFilter(Func<AgentSkill,AgentSkillsSourceContext,Boolean>) |
Sets a filter predicate that controls which skills are included. |
| UseLoggerFactory(ILoggerFactory) |
Sets the logger factory. |
| UseOptions(Action<AgentSkillsProviderOptions>) |
Configures the AgentSkillsProviderOptions using the provided delegate. |
| UsePromptTemplate(String) |
Sets a custom system prompt template. |
| UseSkill(AgentSkill) |
Adds a single skill. |
| UseSkills(AgentSkill[]) |
Adds one or more skills. |
| UseSkills(IEnumerable<AgentSkill>) |
Adds skills from the specified collection. |
| UseSource(AgentSkillsSource) |
Adds a custom skill source. |
| UseSource(Func<ILoggerFactory,AgentSkillsSource>) |
Adds a custom skill source created by a factory that receives the builder's logger factory at build time. Use this overload when the source needs logging and should not require the caller to pass an ILoggerFactory explicitly. |