> ## Documentation Index
> Fetch the complete documentation index at: https://docs.waystone.run/llms.txt
> Use this file to discover all available pages before exploring further.

# Rulesets

> Rulesets are collections or rules that are automatically assigned to requests from users and groups based on a given condition.

Rulesets is Waystone's formulation
for a group of rules to apply to certain requests.
A ruleset consists of:

* Condition - When and to which users the ruleset applies
* Rules - 1 or more [`rules`](./rules/rules) to trigger

Whereas a [`rule`](./rules/rules) is a user-agnostic
trigger->action to take on a request,
rulesets group different rules to apply to users.

Some examples on how rulesets can be used:

* **Ruleset** On `tier=free` users:
  * **Rule** Downgrade o3 to o3-nano
  * **Rule** Block requests if usage has exceeded \$10 in past month
* **Ruleset** For users who joined in the last month:
  * **Rule** Apply a special abuse output check and add their usage to a "to be reviewed" dataset
* **Ruleset** For orgs with `region=eu`:
  * **Rule** Route models to EU-based equivalents
  * **Rule** Delete usage data after 60 days
  * **Rule** Apply extra check on model output for harmful content before returning the response

## Ruleset conditions

Currently,
Waystone allows rulesets to be triggered:

* always
* on a metadata field for groups and users
  * `= value` - Triggers when the field has the exact value
  * `!= value` - Triggers when the field has anything except the given value
  * `is true` - Does the metadata field have a truthy value (1, "some text", `true`)
  * `is false` - Does the metadata field have a falsy value (0, "", `false`)
  * `exists` - Does the metadata field exist with *any* value
