Rule types
| Type | When applied | Best for |
|---|---|---|
always | Injected into every agent interaction. | Fundamental business definitions, default calculations, domain terms. |
agent_requested | Conditionally applied when the agent determines the rule is relevant to the current request. | Scenario-specific guidance, specialized analysis methods. |
agent_requested rules, the description field is what the agent matches against the userâs request to decide whether the rule is relevant â write it as a short summary of when this rule applies. always rules donât need a description since theyâre injected into every interaction regardless.
Defining rules
Rules are defined as Markdown files underagents/rules/. Each rule lives in its own file: the YAML frontmatter holds metadata, and the Markdown body is the rule prompt.
agent_requested rules, add a description so the agent can decide when the rule applies:
rules/ directory are treated as rules automatically â no kind property is required. The name is inferred from the file name (e.g., fiscal-year.md â fiscal-year).
Frontmatter properties
| Property | Type | Required | Description |
|---|---|---|---|
name | string | No | Unique identifier. Inferred from the file name if omitted. |
description | string | No | Required for agent_requested rules â used by the agent to decide when the rule applies. Optional and unused for always rules. |
type | string | Yes | Either always or agent_requested. |
prompt | string | No | Rule prompt. Falls back to the Markdown body if omitted. |
Inlining rules in YAML
You can also inline rules directly inagents/config.yml under a rules key:
name, description, prompt (required), and type (required).
Writing effective rules
Good rules are specific, actionable, and encode context the agent wouldnât otherwise know about your business. Do:- âCustomer churn rate is customers lost á total customers at the start of the period.â
- âWhen analyzing quarterly performance, always compare against the same quarter of the previous year.â
- âOur fiscal year starts in October.â
- âBe helpful.â (too vague)
- âAlways be accurate.â (redundant)
- âConsider all factors.â (too broad)
Domain examples
E-commerce:Resolving conflicts
When multiple rules could apply, follow these guidelines:- Review existing rules before adding new ones to avoid contradictions.
- Use specific triggers in
agent_requestedrules so the agent knows when each rule applies. - Prefer specificity over breadth â narrowly scoped rules override broader defaults more cleanly.
- Test rule combinations with sample queries before relying on them.
always rules directly contradict each other, the agent will surface the conflict in its response. Resolve such conflicts by editing the rules in your repository and redeploying.