> For the complete documentation index, see [llms.txt](https://docs.uptiq.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uptiq.ai/platform-resources/skill-library/data-skills-rag/ruleset.md).

# Ruleset

A simple if/else handles a basic decision — *is `loanAmount` over 5000?* **Ruleset** handles the ones that aren't basic: nested conditions, ANDs and ORs across several data points, tiers.

It applies a predefined set of rules to your input and emits events based on which rules matched. The rules live in a Ruleset Builder rather than in the workflow, so business users can change the logic without touching the workflow — which is usually the actual reason to reach for this skill.

{% hint style="info" %}
**Reference layer pending.** This page documents the skill's purpose and configuration as used in the builder. Its formal configuration schema, output schema, and error codes are not yet documented — see the [Skill Library](/platform-resources/skill-library.md) overview.
{% endhint %}

## Worked example: automated underwriting

A workflow processes incoming loan applications. The initial approval decision depends on credit score, income, debt-to-income ratio, and loan amount, across several tiers:

> if (Credit Score > 700 AND Debt-to-Income < 35%) OR (Loan Amount < 5000 AND Years of Employment > 2) then Approve

**The problem.** Building that with chained conditional nodes gets messy, unreadable, and hard to change — and it's exactly the logic most likely to change.

**The approach.** Define the rules once in the Ruleset Builder. The skill evaluates the applicant's data against them and outputs a decision — `Approved`, `Rejected`, `ManualReview` — that the workflow acts on.

**1. Point at the ruleset.** Select the ID of your underwriting ruleset in **Ruleset ID**.

**2. Map your data to its facts.** The ruleset expects a `Credit Score` fact; your workflow has `applicant.credit_score`. **Mappings** bridges that gap, as `source` → `target` pairs:

* **Source** — the path in your workflow: `$input.applicant.credit_score`
* **Target** — the fact name in the ruleset: `Credit Score`

## Output

**`events`** — a list. Each entry has an `event` name and a set of `params`:

```json
{
  "events": [
    {
      "event": "Approved",
      "params": { "status": "pass", "nextStep": "continue" }
    }
  ]
}
```

{% hint style="warning" %}
**More than one rule can match.** If both a "Pass" rule and a "Flag for Manual Review" rule are satisfied, `events` contains **both** — the skill does not pick a winner. Your workflow decides precedence, and for an underwriting decision that precedence needs to be deliberate rather than "whatever's first in the array."
{% endhint %}

**`statusCode`** — `200` success · `400` no rules matched, or a mapping error.

Note that `400` covers *no rules matched*. That is not necessarily a failure — an application matching no rule may be a real case needing a human — but it arrives looking like an error, so handle it explicitly.

***

To add this skill to an agent, see [Adding a Skill to the Agent](/agent-builder/build/adding-a-skill-to-the-agent.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.uptiq.ai/platform-resources/skill-library/data-skills-rag/ruleset.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
