# MentorDeclarativeOptions class

> The MentorDeclarativeOptions class of Novior.MentorAgent.Declarative: Where AddMentorAgentDeclarative() looks for YAML agent definitions.

- URL: https://docs.mentoragent.net/api/novior-mentoragent-declarative/mentordeclarativeoptions
- Verified with: MentorAgent 1.2.0
- Last updated: 2026-10-27
- Packages: Novior.MentorAgent.Declarative

Where `AddMentorAgentDeclarative()` looks for YAML agent definitions.

## Definition

Namespace: `Novior.MentorAgent.Declarative`. Package: `Novior.MentorAgent.Declarative`.

`public sealed class MentorDeclarativeOptions`

```shell
dotnet add package Novior.MentorAgent.Declarative
```

## Constructors

`public MentorDeclarativeOptions()`

## Properties

### `ConfigurationSection`

`public string? ConfigurationSection { get; set; }`

Name of the configuration section whose values the YAML may reference. Default: `null` — no configuration is exposed.

**Do not be tempted to widen this.** The Agent Framework's factory loads the configuration you give it into the Power Fx engine *as variables*, one per key, in its constructor. Every key therefore has to be a valid Power Fx identifier, and a single one that is not takes the whole factory down before a single definition is read — this was found the hard way, with a key named `${name}` that came from an unrelated configuration provider and produced `ArgumentException: Invalid name: ${name}`. Naming one section bounds the blast radius to keys you control.

```text title="Example"
o.ConfigurationSection = "AgentSettings";   // only AgentSettings:* reaches the YAML
```

### `Definitions`

`public IList<string> Definitions { get; }`

YAML definitions supplied directly, for agents that come from a database, a configuration service or a test. Loaded in addition to [`MentorDeclarativeOptions.Directory`](https://docs.mentoragent.net/api/novior-mentoragent-declarative/mentordeclarativeoptions#directory).

### `Directory`

`public string? Directory { get; set; }`

Directory to scan, relative to the application's base directory or absolute.

**This is a deploy-time path.** A definition file chooses the model, writes the system instructions and names the tools the agent may call — it is code, not configuration. Point this at a folder that ships with the application; never at an upload folder, a user profile directory, or anything assembled from request input.

### `Recursive`

`public bool Recursive { get; set; }`

Scan subdirectories as well. Default: `false`.

### `SearchPattern`

`public string SearchPattern { get; set; }`

File pattern inside [`MentorDeclarativeOptions.Directory`](https://docs.mentoragent.net/api/novior-mentoragent-declarative/mentordeclarativeoptions#directory). Default: `*.agent.yaml`.

---

- Previous: [WasmMentorStateService class](https://docs.mentoragent.net/api/novior-mentoragent-blazor-services/wasmmentorstateservice.md)
- Next: [Declarative.ServiceCollectionExtensions](https://docs.mentoragent.net/api/novior-mentoragent-declarative/servicecollectionextensions.md)
