Questa pagina non è ancora tradotta in italiano: qui la trovi in inglese.
Declarative.ServiceCollectionExtensions
The ServiceCollectionExtensions class of Novior.MentorAgent.Declarative: Registers YAML-defined Level-2 specialists (roadmap #23).
On this page
Registers YAML-defined Level-2 specialists (roadmap #23).
Definition
Section titled “Definition”Namespace: Novior.MentorAgent.Declarative. Package: Novior.MentorAgent.Declarative.
public static class ServiceCollectionExtensions
dotnet add package Novior.MentorAgent.DeclarativeMethods
Section titled “Methods”AddMentorAgentDeclarative
Section titled “AddMentorAgentDeclarative”public static IServiceCollection AddMentorAgentDeclarative(this IServiceCollection services, Action<MentorDeclarativeOptions> configure)
Loads agent definitions from YAML and adds them to MentorAgent's handoff graph, alongside the ones declared with [MentorAgent].
builder.Services.AddMentorAgentDeclarative(o => o.Directory = "Agents");
builder.Services.AddMentorAgent(o => { /* … */ }); // order does not matterA definition looks like this — note that toolsnames tools, it does not define them; each name must match a tool your application already exposes:
kind: Prompt
name: ShippingAgent
description: Answers questions about deliveries and shipping costs
instructions: |
You handle shipping questions only. Use the available tools to look up real orders;
never invent a tracking number. If the question is not about shipping, say so.
model:
options:
temperature: 0.2
tools:
- kind: function # required on every entry; `function` is the only kind kept
name: get_order_status
- kind: function
name: get_all_ordersTreat definition files as code. They choose the model, write the system instructions and name the callable tools, so load them only from a location that ships with the application. What they cannot do is grant themselves anything new: a named tool is resolved from the ones already registered and arrives already wrapped in MentorAgent's gate, keeping RequiredRoles and human approval in force. The provider-hosted kinds the Agent Framework also reads (webSearch, codeInterpreter, fileSearch, mcp) are removed with a warning: those capabilities are the host's to configure.
