MentorAgent Docs
Menu

How-to guidePackage: Novior.MentorAgent

Change options while the app runs

Which MentorAgent options you can change while the application runs, when a change applies, and what happens to the conversations already open.

View as Markdown
On this page

Use this page when an administrator must change how the agent behaves without restarting the application, for example to turn on the safety check, change the rate limit or refuse off-topic questions. MentorAgent reads most options once, before the application starts. Since 1.3.0, it reads sixteen of them again while the application runs, and a change applies to the next turn or to the next session.

  • Choose it for a switch that an administrator flips, such as the safety check or the rate limit, in an application that should not restart.
  • To turn actions on and off, or change their roles and confirmations, use a governor instead: it decides per action, and per session.
  • For any other option, change the configuration and restart the application.

The options are one object for the whole process: the value of IOptions<MentorOptions>. Inject it, and assign the property:

SafetySwitch.cs
// Behind an admin page: switches that apply without a restart
public class SafetySwitch(IOptions<MentorOptions> options)
{
    // From the next turn of every session, open conversations included
    public void TurnOnSafetyCheck()
    {
        if (MentorRuntimeOptions.IsChangeable(
                nameof(MentorOptions.EnableSafetyCheck)))
            options.Value.EnableSafetyCheck = true;
    }

    // From the next session: open conversations keep their value
    public void RefuseOffTopic(bool refuse) =>
        options.Value.RefuseOutOfScope = refuse;
}
  • Assign the property on that object. Every session reads the same object, so the change reaches all of them.
  • Replace a collection, do not change it in place. Assign a new list or set.
  • A turn already running may still read the value from before.
  • MentorRuntimeOptions.IsChangeable(name) says whether an option is read again. MentorRuntimeOptions.Changeable lists them all, each with MentorOptionReadAt.Turn or MentorOptionReadAt.Session.
  • Who may change it is yours to decide. Put the page that changes an option behind your own authorization, as you would any administration page.

From the next turn of every session, including the conversations already open:

OptionWhat a change does
LanguageThe language of the next turn, and the widget's texts
RateLimitPerUserThe limit that the next message is counted against; 0 turns it off
RateLimitWindowSecsThe window that the next message is counted in
ConfirmationMessageThe text of the next confirmation box
ConfirmationTimeoutThe deadline of the next confirmation
ActionPolicyTimeoutThe deadline of the next question to a policy or to the governor
EnableActionFeedbackWhether the next action shows the bar of the running action
EnableGenerativeCardsWhether the next result of a card method becomes a card
EnableSafetyCheckWhether the next message is checked
CheckAnnouncedActionsWhether the next replies are checked for an action that they announce or report as done, and that no tool of the turn did

From the next session: the conversations already open keep the value that they started with.

OptionWhat a change does
MentorshipLevelHow the agent explains and guides, in a new session's instructions
ProactiveNextStepsWhether the Proactive level of a new session closes with next steps
EnableRichResponsesWhether a new session's instructions ask for formatted replies
RefuseOutOfScopeWhether a new session refuses the messages outside your application's scope
ToolFilterMaxToolsThe most tools that a new session's filter sends
MaxSessionMessagesThe history budget of a new session

A session begins with a new Blazor circuit, a new hub connection, a new MAUI app scope, a request to /mentor/chat, or a task over Agent-to-Agent (A2A).

Every other option is read before the application starts. One may seem to work when you change it later, but nothing promises it, and a later version may read it only once. Two are left out on purpose:

  • RequireConfirmation: the Model Context Protocol (MCP) server decides at startup which actions it publishes, so a later change would apply only in part.
  • MaxMessageLength: the input box of the widget gets a copy of the value at startup.

The widget's options, such as BotName, Theme and EnableVoiceInput, are copied when the widget is registered. Some options are also read when the services are registered: see When MentorAgent reads the options.

Each instance has its own options object. A change made through IOptions<MentorOptions> in one instance does not reach the others. To change an option on every instance, change it on each one, for example from a shared setting that each instance reads, or restart them with the new configuration. See Run on several instances.

  • The option is not in the tables above: it is read only before the application starts.
  • The option applies from the next session: open a new conversation.
  • The code changed a collection in place: assign a new one.
  • The application runs on several instances, and the change reached only one.
  • Configuration options — Every MentorOptions property with its type, default and effect, grouped by area, plus the options of the WebAssembly client and the YAML loader.
  • Roles, confirmation and governance — Role checks and human-in-the-loop approval for AI agent tools in .NET, enforced in code on every channel and not in the prompt, and what stays in your code.
  • Production checklist — Settings to review before production: governance, safety check, rate limits, cost and routing, history, several instances, observability and outgoing data.