FileAgentSkillsProvider 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.
An AIContextProvider that discovers and exposes Agent Skills from filesystem directories.
public sealed class FileAgentSkillsProvider : Microsoft.Agents.AI.AIContextProvider
type FileAgentSkillsProvider = class
inherit AIContextProvider
Public NotInheritable Class FileAgentSkillsProvider
Inherits AIContextProvider
- Inheritance
Remarks
This provider implements the progressive disclosure pattern from the Agent Skills specification:
- Advertise β skill names and descriptions are injected into the system prompt (~100 tokens per skill).
- Load β the full SKILL.md body is returned via the
load_skilltool. - Read resources β supplementary files are read from disk on demand via the
read_skill_resourcetool.
Skills are discovered by searching the configured directories for SKILL.md files. Referenced resources are validated at initialization; invalid skills are excluded and logged.
Security: this provider only reads static content. Skill metadata is XML-escaped before prompt embedding, and resource reads are guarded against path traversal and symlink escape. Only use skills from trusted sources.
Constructors
| Name | Description |
|---|---|
| FileAgentSkillsProvider(IEnumerable<String>, FileAgentSkillsProviderOptions, ILoggerFactory) |
Initializes a new instance of the FileAgentSkillsProvider class that searches multiple directories for skills. |
| FileAgentSkillsProvider(String, FileAgentSkillsProviderOptions, ILoggerFactory) |
Initializes a new instance of the FileAgentSkillsProvider class that searches a single directory for skills. |
Properties
| Name | Description |
|---|---|
| ProvideInputMessageFilter |
Gets the filter function to apply to input messages before providing context via ProvideAIContextAsync(AIContextProvider+InvokingContext, CancellationToken). (Inherited from AIContextProvider) |
| StateKey |
Gets the key used to store the provider state in the StateBag. (Inherited from AIContextProvider) |
| StoreInputMessageFilter |
Gets the filter function to apply to request messages before storing context via StoreAIContextAsync(AIContextProvider+InvokedContext, CancellationToken). (Inherited from AIContextProvider) |
Methods
| Name | Description |
|---|---|
| GetService(Type, Object) |
Asks the AIContextProvider for an object of the specified type |
| GetService<TService>(Object) |
Asks the AIContextProvider for an object of type |
| InvokedAsync(AIContextProvider+InvokedContext, CancellationToken) |
Called at the end of the agent invocation to process the invocation results. (Inherited from AIContextProvider) |
| InvokedCoreAsync(AIContextProvider+InvokedContext, CancellationToken) |
Called at the end of the agent invocation to process the invocation results. (Inherited from AIContextProvider) |
| InvokingAsync(AIContextProvider+InvokingContext, CancellationToken) |
Called at the start of agent invocation to provide additional context. (Inherited from AIContextProvider) |
| InvokingCoreAsync(AIContextProvider+InvokingContext, CancellationToken) |
Called at the start of agent invocation to provide additional context. (Inherited from AIContextProvider) |
| ProvideAIContextAsync(AIContextProvider+InvokingContext, CancellationToken) |
When overridden in a derived class, provides additional AI context to be merged with the input context for the current invocation. (Inherited from AIContextProvider) |
| StoreAIContextAsync(AIContextProvider+InvokedContext, CancellationToken) |
When overridden in a derived class, processes invocation results at the end of the agent invocation. (Inherited from AIContextProvider) |