Add agent system with Core and Librarian agent implementations
Define IAgent interface and implement CoreAgent (main conversational agent) and LibrarianAgent (knowledge retrieval agent). Includes DI service collection extensions for agent registration.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
using Luna.Agents.Abstractions;
|
||||
using Luna.Agents.Core;
|
||||
using Luna.Agents.Librarian;
|
||||
using Luna.Configuration.Extensions;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Luna.Agents.Extensions;
|
||||
|
||||
public static class ServiceCollectionExtensions
|
||||
{
|
||||
extension(IServiceCollection services)
|
||||
{
|
||||
public IServiceCollection AddAgents()
|
||||
{
|
||||
services.AddAgent<CoreAgent>();
|
||||
services.AddAgent<LibrarianAgent>();
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
public IServiceCollection AddAgent<TAgent>(string? name = null)
|
||||
where TAgent : class, IAgent
|
||||
{
|
||||
name ??= TAgent.Name;
|
||||
|
||||
services.AddAgentOptions(name);
|
||||
services.AddKeyedTransient<IAgent, TAgent>(name);
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user