-
|
Is there a way to load skills from azure blob storage using AgentSkillsProvider in .NET? The best workaround I found is to download skill files from blob storage locally at startup and then use the standard AgentSkillsProvider pointed at that local directory. The main problem is keeping those local files in sync when a skill file is updated in blob storage - it's unclear what the cleanest approach is to trigger a re-sync without restarting the whole application. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
You do not need to stage skills on local disk for this scenario. Extension point
public abstract class AgentSkillsSource
{
public abstract Task<IList<AgentSkill>> GetSkillsAsync(CancellationToken cancellationToken = default);
}
public AgentSkillsProvider(
AgentSkillsSource source,
AgentSkillsProviderOptions? options = null,
ILoggerFactory? loggerFactory = null);For each public sealed class BlobAgentSkillsSource(BlobContainerClient container) : AgentSkillsSource
{
public override async Task<IList<AgentSkill>> GetSkillsAsync(CancellationToken ct = default)
{
var skills = new List<AgentSkill>();
await foreach (BlobItem item in container.GetBlobsAsync(prefix: "skills/", cancellationToken: ct))
{
if (!item.Name.EndsWith("/SKILL.md", StringComparison.OrdinalIgnoreCase))
{
continue;
}
BlobClient blob = container.GetBlobClient(item.Name);
string content = (await blob.DownloadContentAsync(ct)).Value.Content.ToString();
(string name, string description, string instructions) = ParseSkillMd(content);
skills.Add(new AgentInlineSkill(name, description, instructions));
}
return skills;
}
}This is the same shape as the in-tree Refresh behaviorBy default, For production workloads I recommend the following options, in order of preference: Option 1 — Cache inside the source (recommended)Disable provider caching and own the freshness policy inside services.AddSingleton(_ => new AgentSkillsProvider(
new BlobAgentSkillsSource(container, ttl: TimeSpan.FromMinutes(5)),
new AgentSkillsProviderOptions { DisableCaching = true }));Inside the source, hold a Option 2 — Event-driven invalidationIf your refresh SLA is tighter than a TTL allows, subscribe to Blob Storage events via Event Grid → an HTTP-triggered handler that resets the in-source cache ( Option 3 — Rebuild the providerRegister RecommendationStart with Option 1. It is the lowest-operational-cost pattern, gives you explicit control over both caching layers, and is approximately 30 lines of code. Move to Option 2 if and when your business requirements demand sub-minute propagation of skill changes. I would avoid stacking BlobFuse2 under the existing file-based source — you inherit BlobFuse's caching semantics on top of |
Beta Was this translation helpful? Give feedback.
You do not need to stage skills on local disk for this scenario.
AgentSkillsProvideris built around a pluggableAgentSkillsSourceabstraction, which is the supported extension point for backing skills with a remote store such as Azure Blob Storage.Extension point
AgentSkillsSourceis a single asynchronous method, and the XML documentation explicitly calls out remote backends as a supported origin:AgentSkillsProvideraccepts a source directly via its constructor: