# AI Agent

## What Is an AI Agent?

An **AI Agent** is a rule type that delegates decision logic to a large language model (LLM). Instead of defining explicit conditions and outcomes — as you would in a Decision Table or Decision Tree — you describe what you want the model to do via a natural language prompt and a structured output schema. The model then reasons over the input and returns a typed, structured JSON response every time the rule is called.

What makes AI Agents different from other rule types is their ability to handle **judgment, language, and ambiguity**. They can read a contract and extract its key terms, evaluate a supplier narrative and produce a risk score, validate a dataset against a policy, or write a plain-language summary of a complex decision, all without a single hard-coded condition.

Each AI Agent is best built around a single, clearly defined task. In practice, the most common patterns are:

* **Decision making:** evaluating input and producing a decision, score, or routing outcome
* **Deep analysis:** reading documents, records, and signals to extract structured intelligence
* **Report writing:** condensing complex input into a concise, decision-ready narrative
* **Policy validation:** checking data against rules and standards; fixing and normalizing non-conforming records

If your use case doesn't fit any of these patterns, you can define the role and task freely from scratch in the prompt.

{% hint style="info" %}
**When not to use an AI Agent:** \
If your logic can be fully expressed as explicit conditions and outcomes, a Decision Table or Decision Tree will be faster, more predictable, and easier to audit. Use an AI Agent when the complexity or ambiguity of the input makes explicit rules impractical.
{% endhint %}

## AI Agent vs. Other Rule Types

<table><thead><tr><th width="147.12890625">Parameters</th><th width="193.74609375">Decision Table</th><th width="192.421875">Decision Tree</th><th>AI Agent</th></tr></thead><tbody><tr><td><strong>Input type</strong></td><td>Structured values</td><td>Structured values</td><td>Structured or unstructured</td></tr><tr><td><strong>Logic definition</strong></td><td>Condition/result rows</td><td>Branching conditions</td><td>Natural language prompt</td></tr><tr><td><strong>Output</strong></td><td>Fixed result values</td><td>Fixed result values</td><td>Typed JSON generated by LLM</td></tr><tr><td><strong>Determinism</strong></td><td>Fully deterministic</td><td>Fully deterministic</td><td>Probabilistic (caching available)</td></tr><tr><td><strong>Auditability</strong></td><td>Full row-level trace</td><td>Full branch trace</td><td>Explainable AI output (optional)</td></tr><tr><td><strong>Best for</strong></td><td>Tabular business rules</td><td>Hierarchical decisions</td><td>Reasoning, scoring, extraction</td></tr></tbody></table>

## What You Will Find in This Section

{% content-ref url="ai-agent/ai-agent-designer" %}
[ai-agent-designer](https://docs.decisionrules.io/doc/rules/ai-agent/ai-agent-designer)
{% endcontent-ref %}

{% content-ref url="ai-agent/caching" %}
[caching](https://docs.decisionrules.io/doc/rules/ai-agent/caching)
{% endcontent-ref %}

{% content-ref url="ai-agent/explainable-ai" %}
[explainable-ai](https://docs.decisionrules.io/doc/rules/ai-agent/explainable-ai)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.decisionrules.io/doc/rules/ai-agent.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
