Method LoadAndRegisterAsync
LoadAndRegisterAsync(string, bool, CancellationToken)
Asynchronously loads and registers a skill from a directory.
public Task<AgentSkill> LoadAndRegisterAsync(string skillPath, bool overwrite = false, CancellationToken cancellationToken = default)
Parameters
skillPathstringThe path to the skill directory.
overwriteboolWhether to overwrite existing skills with the same name.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task<AgentSkill>
A task that represents the asynchronous operation, containing the loaded and registered skill.
Examples
Asynchronously loading and registering a skill:
var registry = new SkillRegistry();
var skill = await registry.LoadAndRegisterAsync("./skills/code-review");
Console.WriteLine($"Loaded: {skill.Name}");
Exceptions
- SkillParseException
Thrown when the skill cannot be parsed.
- OperationCanceledException
Thrown when the operation is cancelled.