AgentSettings Class
Assembly: CodeEffects.Rule.Repository.dll
Namespace: CodeEffects.Rule.Repository
Summary
Sets what AI agents may do beyond what their permissions say: how many saved tests they may run, whether their test runs are recorded, and whether they may read data source items.
Syntax
public class AgentSettings
Set an instance on the Agents property of your IRepositoryConfiguration, for example on a Configuration object. When Agents is null, the repository uses the defaults listed below, which are also the values of a new AgentSettings.
The same object applies wherever an agent works: the tools that the Rule Repository offers through its MCP server, and the AI Assistant inside the Rule Repository. The permission set of the current user still decides what an agent may do at all. These settings only narrow it, never widen it.
Constructors
Properties
AgentDataSourceItems
Type: System.Boolean
Gets or sets whether agents may read data source items: the live records that a data source's method returns, which an agent uses to turn a name such as "Gold tier" into its ID. When it is false, agents are not offered the tool that reads them, a request for them is refused, and a value that comes from a data source is left for a person to pick in the Rule Repository. The default value is true.
AgentTestLimits
Type: CodeEffects.Rule.Repository.TestRunLimits
Gets or sets how many saved tests an AI agent may run per call and per hour, and how many runs it may have under way at once, counted for each agent. It applies when the current user type is not UserType.Service, that is, to an agent and to an agent that acts for a person. The defaults are 10, 100, and 2.
DataSourceItemFilter
Type: CodeEffects.Rule.Repository.DataSourceItemFilter
Gets or sets an optional filter that narrows which data source items agents may read when AgentDataSourceItems is true. The default value is null: agents may read every item of every data source.
DataSourceItemFilter is a delegate with the signature bool DataSourceItemFilter(string dataSourceName, string itemId, string itemLabel). The repository calls it for each item and leaves out the items for which it returns false. The name is the data source's name as the source declares it, the ID is the item's ID or key as text, and the label is the item's name as the data source's method returns it.
RecordAgentTestRuns
Type: System.Boolean
Gets or sets whether an agent's run of saved tests writes a Test Run entry to the user activity that names the tests and their outcomes. The outcomes are recorded on the tests either way. The default value is true.
ServiceTestLimits
Type: CodeEffects.Rule.Repository.TestRunLimits
Gets or sets the same limits for a service (UserType.Service), counted for each service. The defaults are 10, 100, and 2.
Static Properties
Default
Type: CodeEffects.Rule.Repository.AgentSettings
Gets a new AgentSettings object with the default values: what a configuration with no Agents setting gets.
Example
using CodeEffects.Rule.Repository;
var configuration = new Configuration
{
Agents = new AgentSettings
{
AgentTestLimits = new TestRunLimits { TestsPerCall = 5, TestsPerHour = 50, TestsAtOnce = 1 },
RecordAgentTestRuns = true,
DataSourceItemFilter = (dataSourceName, itemId, itemLabel) => dataSourceName != "Employees"
}
};