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

# Lesson 11: Guardrails and Values

> What guardrails and values alignment mean for an AI app, how guarded and direct endpoints differ from your side, how Gloo measures values alignment, and what your app is still responsible for.

## Good Prompts Aren't the Whole Story

Everything in this course so far has been about what *you* send: clear tasks, the right context, good examples, a helpful role. That shapes most of what comes back.

But when you build an app, other people write the prompts. Some will ask things you never planned for. A few will try to make the AI misbehave. And "a helpful answer" can still be wrong for your audience: off-mission, careless about someone's wellbeing, or at odds with your community's values.

That's where **guardrails** and **values alignment** come in. In this lesson you'll learn what they mean, what Gloo's guarded endpoints do for you, how Gloo measures whether a model's answers support human flourishing, and what your app still has to handle itself.

***

## Core Concepts

### What Guardrails Are

[Guardrails](https://docs.gloo.com/ai-learning-center/gloo-ai-101/application-patterns.md#guardrails) are safety rules placed around an AI system. They decide what it will and won't do or say.

Think of a lifeguard at a pool. Swimmers choose where to swim and how fast; the lifeguard steps in only when something is unsafe. Guardrails are there for the moment a request or an answer crosses a line.

Guardrails can act at two points:

* **Before the model answers**: screening the request, so a harmful or out-of-bounds request is turned away or answered carefully
* **After the model answers**: **moderating** the response, so an unsafe reply is replaced before your user sees it

### What Values Alignment Is

Safety asks "could this cause harm?" Values alignment asks a different question: "does this answer fit who we are and who we serve?"

Two answers can both be safe while only one fits. A question about forgiveness, grief or money can get a neutral, generic answer, or one that reflects your community's convictions and cares about the person asking. For many organizations, especially churches and ministries, the second is the one that matters.

On Gloo, the `tradition` setting lets you steer answers toward a theological perspective: `evangelical`, `catholic`, `mainline` or `not_faith_specific`, or leave it out for a general Christian perspective. It steers the response. It isn't a guarantee of any particular doctrinal position.

### Direct and Guarded: The Choice from Your Side

Gloo's two main kinds of endpoint for generating answers differ in what Gloo adds around your request.

| | Direct | Guarded |
| :- | :- | :- |
| **What Gloo adds** | Nothing between your prompt and the model | Guardrails, output moderation and values alignment (`tradition`) |
| **What you get back** | Exactly what the model returned | An answer that has been screened and moderated |
| **Who handles safety** | Your app | Gloo, for these checks |
| **Price** | The model's rate | The model's rate plus 6.5% for guardrails, moderation and values alignment |
| **Best for** | Apps that already handle their own safety and prompting end to end | Apps where any traffic needs screening, or where you want values-aligned answers without building that yourself |

Gloo's guardrails consider six dimensions of AI safety: **Physical, Ethical, Emotional, Factual, Theological and Security**.

The request is the same for both; only the URL changes. [Endpoint Types](https://docs.gloo.com/api-guides/endpoint-types.md) compares them in full.

### What Guarded Looks Like to Your App

When guardrails step in, your app sees one of a few outcomes. None of them should be treated as a crash.

* **A curated answer.** Sometimes guardrails respond with a prepared, values-aligned reply. It comes back as a normal answer, so your app needs no special handling.
* **A blocked request.** A request the guardrails reject outright returns a `403` error. Show your user a kind, helpful message instead of sending the same text again.
* **A replaced reply.** Moderation can replace a response. On Chat Completions, streamed or not, a moderated reply ends with `finish_reason: "content_filter"`; on Responses, it arrives as a normal finished reply. Treat it like any other finished reply.

One detail to know: if a [reasoning model](https://docs.gloo.com/ai-learning-center/gloo-ai-102/models-that-think.md) returns its reasoning (`reasoning_content` on Chat Completions, a reasoning summary on Responses), that reasoning isn't moderated, and it can still come back when the answer is replaced. Decide whether to show it to users with that in mind. See [Reasoning is not moderated](https://docs.gloo.com/api-guides/reasoning.md#reasoning-is-not-moderated).

### How Gloo Measures Values Alignment

Most well-known benchmarks test reasoning, knowledge or code, not whether advice about relationships or purpose is actually good for the person.

Gloo evaluates models with the **Flourishing AI Initiative (FAI)** framework, which scores answers across **seven dimensions of human flourishing**:

1. **Character:** virtue, moral reasoning and self-regulation
2. **Happiness:** life satisfaction and emotional wellbeing
3. **Relationships:** connection and community
4. **Meaning:** purpose and significance
5. **Health:** physical and mental wellness
6. **Finances:** economic stability and stewardship
7. **Faith:** spiritual formation, theological coherence and religious engagement

A judge model with defined expert criteria scores responses to a curated set of over 800 prompts. Each answer gets three scores, for factual accuracy, for alignment with that dimension's flourishing criteria, and for relevance and safety, combined into one score with a geometric mean.

There are two standards, so you can measure against the audience you serve:

* **FAI-G (General)** measures broad human wellbeing, judged by secular domain experts.
* **FAI-C (Christian)** measures alignment with a Christian worldview, judged by Christian domain experts.

Gloo's published findings show why this matters: frontier models often do well on practical dimensions like Health and Finances, but tend to underperform on values-based ones like Faith and Meaning. See [Benchmarking](https://docs.gloo.com/learn-more/benchmarking.md) for the methodology and links to the live leaderboard.

### What Your App Is Still Responsible For

Guardrails catch a lot, but they can't know your app's purpose, your users or your rules. Even on a guarded endpoint, these stay with you:

* **Your own instructions.** What your app is for, what it should decline, and how it should say no. Put them in your system message.
* **Treating outside text as data.** When your app passes along a document, a transcript or a web page, mark it clearly as content to work on, not instructions to follow. This is your defense against [prompt injection](https://docs.gloo.com/ai-learning-center/gloo-ai-101/challenges-and-risks.md#prompt-injection).
* **Checking facts.** Guardrails screen for safety, not accuracy. When answers draw on your content, check quotations and titles against the sources, as in [AI 103](https://docs.gloo.com/ai-learning-center/gloo-ai-103/citations-and-verification.md).
* **What the AI may do.** If the AI can call tools or take actions, you decide which ones, and when a person must approve.
* **Kind handling of every outcome.** Blocked, replaced and declined answers all need a message your users understand.
* **Testing with your own questions.** Build a set of real and tricky questions for your audience and check the answers before you launch, and again after every change.

On a direct endpoint, all of the guarded protections become yours too.

***

## Try It Yourself

### Exercise 1: Direct or Guarded?

For each app, choose direct or guarded, and write one sentence on why:

1. A public prayer-request helper on a church website
2. An internal tool that reformats your own sermon notes into a weekly email
3. A youth group Q\&A bot
4. A coding assistant your developers use on their own code

### Exercise 2: Plan for Every Outcome

Your guarded app gets a `403` for a user's message. Write the message your app shows. Then write the message for a Chat Completions reply that ended with `finish_reason: "content_filter"`. Keep both kind, short and free of blame.

### Exercise 3: Map the Seven Dimensions

Pick three questions your users might ask, such as "How do I talk to my teenager about money?" For each, note which of the seven flourishing dimensions it touches, and describe what a flourishing-minded answer would include that a merely safe answer might not.

***

## Common Pitfalls

### Pitfall 1: Thinking Guardrails Make an App Safe on Their Own

Guardrails screen requests and moderate answers. They don't know your app's purpose, check your facts or decide what your tools may do.

**The fix:** Use guardrails as one layer. Add your own instructions, verification and approvals for the parts only your app understands.

### Pitfall 2: Treating a Block as an Error

A blocked request or a replaced reply is the system doing its job. Showing a raw error or retrying the same text frustrates users and changes nothing.

**The fix:** Handle `403` and `content_filter` as normal outcomes, with a friendly message and, where it fits, a pointer to a person who can help.

### Pitfall 3: Expecting `tradition` to Settle Every Question

The `tradition` setting steers answers toward a perspective. It doesn't guarantee a particular doctrinal position on every topic.

**The fix:** Combine it with your own clear instructions and, where accuracy matters, content you've chosen through grounding. Test answers on the topics your community cares most about.

### Pitfall 4: Choosing a Model Only by General Benchmarks

A model that tops a reasoning leaderboard may still give flat or unhelpful answers on faith, meaning or relationships.

**The fix:** Look at values-focused evaluations like FAI alongside general ones, and test candidate models on questions from your own audience.

### Pitfall 5: Choosing Direct Without Your Own Safety

Direct endpoints bill the model's rate and add no screening or moderation.

**The fix:** If you choose direct, make sure your app handles safety and values itself. When you want them built in, choose guarded.

***

## Level Up

Here's a challenge that brings it all together.

**Scenario:** A ministry wants an app where people can ask questions about grief, faith and family. Some users will be in real distress. Some will test its limits. The ministry wants answers that reflect its tradition and care for each person.

**Your task:** Write a one-page plan that covers:

1. Direct or guarded, and why
2. Which `tradition` setting fits, and what you'll put in your own system message on top of it
3. What your app shows when a request is blocked or a reply is replaced
4. How you'll handle someone who appears to be in crisis, and when a person should step in
5. Which of the seven flourishing dimensions matter most here, and five test questions you'll use for each before launch
6. What you'll check after every change to prompts or models

***

## Key Takeaway

Guardrails keep answers safe; values alignment keeps them fitting for the people you serve. Direct endpoints leave safety to your app; guarded endpoints screen requests, moderate answers and steer toward a `tradition` for you. Either way, your app still owns its instructions, facts, tools, outcome handling and testing with your own users' questions.

> [!TIP]
>
> **Try it on Gloo:** [Direct Responses](https://docs.gloo.com/api-guides/direct-responses.md) is the endpoint for new apps that own their safety, and [Responses](https://docs.gloo.com/api-guides/responses.md) is the guarded endpoint that takes the same request when you want Gloo's guardrails and `tradition`.

***

## Learn more

* [Endpoint Types](https://docs.gloo.com/api-guides/endpoint-types.md): guarded, direct and grounded endpoints side by side, with pricing
* [Guarded endpoints: when and how](https://docs.gloo.com/api-guides/endpoint-types.md#guarded-endpoints): what guarded adds and how to switch
* [Guarded Endpoints best practices](https://docs.gloo.com/best-practices/guarded-endpoints.md): prompt structure, structured output, and handling blocked requests, moderated replies and retries
* [Benchmarking](https://docs.gloo.com/learn-more/benchmarking.md): the Flourishing AI framework and its seven dimensions
* [Building Trustworthy Grounded Applications](https://docs.gloo.com/best-practices/trustworthy-grounded-applications.md): what your app owns when answers draw on your content

***

## What's next

When you're ready to finish the course, the final lesson turns everything you've learned into a practical framework you can use every day.

> **[Lesson 12: Putting It All Together](https://docs.gloo.com/ai-learning-center/gloo-ai-102/all-together.md)**
>
> A prompt engineering checklist, personal prompt templates and a capstone challenge.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.