MentorAgent Docs
Menu

ReferencePackage: Novior.MentorAgent

MentorLiveSkillsSource class

The MentorLiveSkillsSource class of Novior.MentorAgent.Core: An AgentSkillsSource that MentorOptions.SkillsRefreshInterval never caches: wrap a source in it…

View as Markdown
On this page

An AgentSkillsSource that MentorOptions.SkillsRefreshInterval never caches: wrap a source in it, in MentorOptions.SkillSources, when what it gives must reach every session built after a change, not one built after the interval (rule skill.live-source).

With a refresh interval each source is cached on its own, so the others keep their cache while this one is asked every time a session's coordinator is built: a skill it withdraws is gone for the next session, and one it adds is there. A session keeps the list it started with, as for every source. Without an interval nothing changes, because every source is then read at every session anyway.

It is for a source that is cheap to ask and whose changes must count at once, such as the console of an integration that withdraws a skill. It composes with MentorPreferredSkillsSource, in either order, and MentorOptions.SkillFilter and the de-duplication apply to its skills as to the others'.

Example
options.SkillsRefreshInterval = TimeSpan.FromMinutes(15);        // the remote catalogue is read every 15 minutes
options.SkillSources =
[
    new MentorLiveSkillsSource(new MentorPreferredSkillsSource(consoleSkills)),   // read at every session
    new AgentFileSkillsSource("/srv/shared-skills"),                              // cached
];

Namespace: Novior.MentorAgent.Core. Package: Novior.MentorAgent.

public sealed class MentorLiveSkillsSource : AgentSkillsSource

Terminal
dotnet add package Novior.MentorAgent

public MentorLiveSkillsSource(AgentSkillsSource inner)

Wraps inner, which is then asked at every session, never cached.

public AgentSkillsSource Inner { get; }

The source asked at every session.

public override Task<IList<AgentSkill>> GetSkillsAsync(AgentSkillsSourceContext context, CancellationToken cancellationToken = default)