Skip to content

Install And Reload Skills ​

Use managed skills when the host needs to install, update, list, or delete packages independently of application compilation.

Two contracts have different jobs:

text
ISkillStore
    installs, updates, lists, and deletes packages

ISkillSource
    selects skills for one owning tool harness

Installing a package does not expose it globally. AddSkillsFromStore() explicitly attaches selected packages to a harness.

Package, resource, and script names use the model-facing naming rule: 1-64 ASCII letters, digits, underscores, or hyphens, beginning with a letter or underscore. Invalid names fail installation before the package publishes.

Share One Store Across Harnesses ​

A store may contain packages intended for different harnesses. Add host-defined tags to package manifests and select a filtered view for each harness:

csharp
var dataPackage = new SkillPackage
{
    Manifest = new SkillPackageManifest
    {
        Id = "data-analysis",
        Name = "data_analysis",
        Description = "Helps validate and analyze datasets.",
        Version = "1",
        Tags = new Dictionary<string, string>
        {
            ["domain"] = "data"
        }
    },
    Instructions = File.OpenRead("data-analysis.md")
};
csharp
new AgentConfig()
    .WithToolHarness<DataTools>(options =>
        options.AddSkillsFromStore(
            SkillQuery.WithTag("domain", "data")))
    .WithToolHarness<SupportTools>(options =>
        options.AddSkillsFromStore(
            SkillQuery.WithTag("domain", "support")));

Use SkillQuery.ByIds(...) when the exact package IDs are known. The no-argument AddSkillsFromStore() means all packages and is appropriate when only one harness consumes that store. HPD rejects attaching the same store unfiltered to multiple harnesses because every harness would otherwise claim every package.

The store manages inventory; the attachment determines ownership. Tags do not grant permission and are not chosen by the model.

Dependency Injection ​

csharp
var services = new ServiceCollection();
services.AddHPDSkills();

using var serviceProvider = services.BuildServiceProvider();
var skillStore = serviceProvider.GetRequiredService<ISkillStore>();

await skillStore.InstallAsync(package);

var analyst = new AgentConfig()
    .WithToolHarness<DataTools>(options =>
        options.AddSkillsFromStore());

await using var runtime = await new AgentRuntimeBuilder()
    .WithServiceProvider(serviceProvider)
    .AddAgent("analyst", analyst)
    .BuildAsync();

AddSkillsFromStore() without a store writes a selector against the runtime's skill store onto the harness reference. The selector is data, so a definition that uses it can be serialized and kept in the agent store; every agent the runtime builds from it, stored agents included, reads the same runtime skill store.

AddHPDSkills() preserves existing registrations. Without replacements, it provides an ephemeral InMemoryContentStore and a ContentStoreSkillStore backed by it.

For persistence, register the content store before building the service provider:

csharp
services.AddSingleton<IContentStore>(
    new LocalFileContentStore("./agent-data"));
services.AddHPDSkills();

Package manifests and exact content snapshots can then be reconstructed after restart.

Without Dependency Injection ​

csharp
var contentStore = new InMemoryContentStore();
var skillStore = new ContentStoreSkillStore(
    contentStore,
    ContentStoreScopes.Skills);

await skillStore.InstallAsync(package);

var analyst = new AgentConfig()
    .WithToolHarness<DataTools>(options =>
        options.AddSkillsFromStore());

await using var runtime = await new AgentRuntimeBuilder()
    .WithContentStore(contentStore)
    .WithSkillStore(skillStore)
    .AddAgent("analyst", analyst)
    .BuildAsync();

The skill store belongs to the runtime. The application retains skillStore as its management-plane service. AddSkillsFromStore(store, query) with an explicit store instead attaches that store to the harness reference as a process-local part of the definition.

Install A Package ​

csharp
await skillStore.InstallAsync(new SkillPackage
{
    Manifest = new SkillPackageManifest
    {
        Id = "data-analysis",
        Name = "data_analysis",
        Description = "Helps validate and analyze datasets.",
        Version = "1"
    },
    Instructions = File.OpenRead("instructions.md"),
    Resources =
    [
        new SkillPackageResource
        {
            Name = "read_validation_guide",
            Description = "Reads the dataset validation requirements.",
            Content = File.OpenRead("validation-guide.md"),
            ContentType = "text/markdown"
        }
    ]
});

Package versions are immutable. Updating requires a new version and may require the expected current version:

csharp
await skillStore.UpdateAsync(
    "data-analysis",
    versionTwoPackage,
    expectedVersion: "1");

await skillStore.DeleteAsync(
    "data-analysis",
    expectedVersion: "2");

Expected versions prevent accidental overwrites. Deletion removes the current publication while allowing already-running work to finish against its retained content.

Reload Behavior ​

Watchable stores notify attached agents automatically. HPD rereads and validates the complete selected inventory. Invalid changes remain installed but do not replace that agent's last valid catalog.

Manual reload is also available and detects changes made by another store or process:

csharp
var result = await runtime.RefreshCapabilitiesAsync("analyst");

if (!result.Published)
    Console.WriteLine(result.Error);

RefreshCapabilitiesAsync(agentId) rereads every attached dynamic source of that agent, building it first if it has not run yet, and publishes the complete validated capability epoch. There is no skills-only reload method.

Hot reload applies to instructions, resources, scripts, and runtime package metadata. Changes to compiled C# methods, generated harnesses, or assemblies require a rebuild and restart.

Built for production .NET agent applications.