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

# Guardrails

> Control what code Sphinx generates and executes with configurable permission levels

## Overview

Guardrails enable you to control what code Sphinx will generate and execute, giving you fine-grained control over AI-generated code behavior and security.

## Guardrail modes

<AccordionGroup>
  <Accordion title="Always Allow" icon="circle-check">
    Sphinx can always run code with a given artifact without requesting permission. Use this for trusted operations and frequently used libraries.
  </Accordion>

  <Accordion title="Ask For Permission" icon="circle-question">
    Sphinx must get approval from you before running code with a given artifact. Recommended for sensitive operations or unfamiliar tools.
  </Accordion>

  <Accordion title="Ask and Avoid" icon="circle-xmark">
    Sphinx will avoid generating code with the artifact when possible and ask for approval if it must use it. Best for restricted or dangerous operations.
  </Accordion>
</AccordionGroup>

## Configuring guardrails

<Steps>
  <Step title="Open the dashboard">
    Navigate to [the dashboard](https://dashboard.prod.sphinx.ai) and sign in to your account.
  </Step>

  <Step title="Access guardrails settings">
    Click on the **Guardrails** tab in the navigation menu.
  </Step>

  <Step title="Select guardrail mode">
    Click on the new mode you want to apply for the specific artifact or operation.
  </Step>

  <Step title="Save your changes">
    Click **Apply changes** to activate your new guardrail configuration.
  </Step>
</Steps>

<Frame caption="Configuring guardrails in the Sphinx dashboard">
  <video controls>
    <source src="https://mintcdn.com/sphinx-977f1673/CNANHQ3bdJ4mrU5G/features-resources/guardrails/configuring-guardrails.mp4?fit=max&auto=format&n=CNANHQ3bdJ4mrU5G&q=85&s=536c1bc877b920ad80841a20fb18dfad" type="video/mp4" data-path="features-resources/guardrails/configuring-guardrails.mp4" />
  </video>
</Frame>

## How it works

When a guardrail is triggered, Sphinx will request approval before executing code. If approval is not granted, the agent will attempt to make progress using alternative approaches when possible.

<Frame caption="Example of guardrail approval workflow">
  <video controls>
    <source src="https://mintcdn.com/sphinx-977f1673/9TH8v1SCDQriV3tc/features-resources/guardrails/guardrails-approved.mp4?fit=max&auto=format&n=9TH8v1SCDQriV3tc&q=85&s=6da114ce1f4a8ab29b12f82cb3af89bb" type="video/mp4" data-path="features-resources/guardrails/guardrails-approved.mp4" />
  </video>
</Frame>

<Tip>
  Start with "Ask For Permission" mode for new artifacts until you're confident in their behavior, then switch to "Always Allow" for trusted operations to improve workflow efficiency.
</Tip>
