# AWS Guardrails

AWS Guardrails features include:

* Content filtering (preventing explicit, violent content, etc.)
* Topic deviation prevention
* Word restrictions
* Sensitive data removal
* Hallucination prevention

## <mark style="color:blue;">Operation Steps</mark>

### Step 1: Configure Settings (Name, Description, Blocked Message Response)

<figure><img src="/files/3zYy4ESoxduV4jkVorqy" alt=""><figcaption></figcaption></figure>

Example settings:

<figure><img src="/files/Z9MxvieVTg3q5CKLparV" alt=""><figcaption></figcaption></figure>

### Step 2: Set Content Filtering (User Input, Assistant Response)

<figure><img src="/files/nLNU21iHG5kFJtzt7C3V" alt=""><figcaption></figcaption></figure>

You can specify harm levels, including image inputs

<figure><img src="/files/SNDdaVm1KpUrzHOh9EBq" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/LSKHf6tVl4e6Kmd7SGR2" alt=""><figcaption></figcaption></figure>

Example settings:

<figure><img src="/files/gZoAMUcphS4xyHNplc3U" alt=""><figcaption></figcaption></figure>

### Step 3: Topic Rejection, Preventing Off-Topic Responses

<figure><img src="/files/wc75sEOL0dFsd94455XI" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/gpMk0X2F5yUdLIa4YcR6" alt=""><figcaption></figcaption></figure>

You can prevent off-topic responses by adding descriptions, definitions, and examples

Example settings:

<figure><img src="/files/72xEGgWAAbTsiFyRCAsc" alt=""><figcaption></figcaption></figure>

### Step 4: Word Restrictions (Blocking Profanity or Specific Terms)

For example: To prevent the model from mentioning Voldemort, add words - multiple words can be input at once (csv, txt, ctrl + c).

<figure><img src="/files/EVtfoh4BNvDpCqVsjVO7" alt=""><figcaption></figcaption></figure>

Example settings:

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXcb-3vRt-Q0UkPhKEbzpygdBa4ALAaKUsXTil3m5PS3PHLQcR_3jpXXkn6T6-YoaONvnCc0H1RDrhIj-aq0WzCunLW99auRRCu36bNOEBnYqrsgK6Up5uehpKqqreKzXPWxSU0x?key=z1hebxFSyJWvHprMJ3hgOr8k)

### ![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXczJwuyAQ4-FbNaBymncor9v3HA9mUURj_ghPn8N1FyNUkNvr_hW9WXw1C9ZYX3gcR5s0uYS_IybmgQ_1pSfnHNf6GTiJCu8H7apoiIm2Bczjfe1csDR3WVDpRuYWRCPS22K2OdQQ?key=z1hebxFSyJWvHprMJ3hgOr8k)

### Step 5: Sensitive Data (PII) Blocking and Regex Replacement

Several patterns are preset, such as credit cards, vehicle numbers, ID numbers, etc.

<figure><img src="/files/uYVx1zVzhKDmm5vVLpRN" alt=""><figcaption></figcaption></figure>

Example settings:

<figure><img src="/files/1rGDvokMwnwxepZ5VnXO" alt=""><figcaption></figcaption></figure>

Regex replacement allows you to replace unwanted structures in AI assistant responses using desired regular expressions.

### Step 6: Preventing Hallucinations and Setting Relevance Threshold for Response Blocking

<figure><img src="/files/gG3X4ExjyjJYTd14Lmbi" alt=""><figcaption></figcaption></figure>

Example settings:

<figure><img src="/files/l0bBf72rjjUi5ohR7Eo4" alt=""><figcaption></figcaption></figure>


---

# 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.maiagent.ai/tech/maiagent-tech-en/ai-agents/aws-guardrails.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.
