-
-
Notifications
You must be signed in to change notification settings - Fork 628
Expand file tree
/
Copy pathAgentSkillsPlugin.cs
More file actions
57 lines (49 loc) · 2.47 KB
/
AgentSkillsPlugin.cs
File metadata and controls
57 lines (49 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using BotSharp.Abstraction.Agents;
using BotSharp.Abstraction.Functions;
using BotSharp.Abstraction.Settings;
using BotSharp.Plugin.AgentSkills.Functions;
using BotSharp.Plugin.AgentSkills.Services;
using BotSharp.Plugin.AgentSkills.Skills;
using Microsoft.Extensions.AI;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
namespace BotSharp.Plugin.AgentSkills;
/// <summary>
/// Agent Skills plugin for BotSharp.
/// Enables AI agents to leverage reusable skills following the Agent Skills specification (https://agentskills.io).
/// Implements requirements: FR-1.1, FR-3.1, FR-4.1
/// </summary>
public class AgentSkillsPlugin : IBotSharpPlugin
{
public string Id => "a5b3e8c1-7d2f-4a9e-b6c4-8f5d1e2a3b4c";
public string Name => "Agent Skills";
public string Description => "Enables AI agents to leverage reusable skills following the Agent Skills specification (https://agentskills.io).";
public string IconUrl => "https://raw.githubusercontent.com/SciSharp/BotSharp/master/docs/static/logos/BotSharp.png";
public string[] AgentIds => [];
/// <summary>
/// Register dependency injection services.
/// Implements requirements: FR-1.1, FR-3.1, FR-4.1, FR-6.1, NFR-4.1
/// </summary>
public void RegisterDI(IServiceCollection services, IConfiguration config)
{
// FR-6.1: Register AgentSkillsSettings configuration
// Use ISettingService to bind configuration from appsettings.json
services.AddScoped(provider =>
{
var settingService = provider.GetRequiredService<ISettingService>();
return settingService.Bind<AgentSkillsSettings>("AgentSkills");
});
// FR-1.1: Register AgentSkillsFactory as singleton
// Singleton pattern avoids creating multiple factory instances
services.AddSingleton<AgentSkillsFactory>();
// FR-1.1, NFR-4.1: Register ISkillService and SkillService as scoped
services.AddScoped<ISkillService, SkillService>();
services.AddScoped<IFunctionCallback, GetInstructionsFn>();
services.AddScoped<IFunctionCallback, GetSkillBynameFn>();
services.AddScoped<IFunctionCallback, GetSkillFileContentFn>();
// FR-2.1: Register AgentSkillsInstructionHook for instruction injection
services.AddScoped<IAgentHook, AgentSkillsInstructionHook>();
// FR-3.1: Register AgentSkillsFunctionHook for function registration
services.AddScoped<IAgentHook, AgentSkillsFunctionHook>();
}
}