Configure guardrails - Writer AI Studio

Documentation Index

Fetch the complete documentation index at: /llms.txt

Use this file to discover all available pages before exploring further.

This page covers the technical architecture and configuration options for guardrails in AI Studio. Guardrails enable organizations to enforce content safety, PII protection, and compliance policies across AI agents by integrating with external guardrail providers like AWS Bedrock Guardrails and Azure AI Content Safety.For step-by-step instructions on configuring guardrails in the AI Studio interface, see Setting up guardrails in the Writer Help Center.

Guardrails are available on Enterprise plans. Org admins and IT admins can configure guardrails in AI Studio.

How guardrails work

AI Studio’s guardrail system sits between your agents and LLM calls, intercepting requests at configurable points to check content against your configured guardrail providers. This architecture provides centralized safety controls and compliance enforcement for all AI interactions.

For now, guardrails used with the API, SDK, and Agent Builder will only apply to external provider models.

Guardrails can check content at three points in the request lifecycle:

When a guardrail detects a violation, the request is halted and an error is returned to the agent.

For no-code chat apps, guardrails evaluate only the last message in the conversation, not the full conversation history.

Supported guardrail providers

AI Studio integrates with the following guardrail providers:

AWS Bedrock Guardrails

AWS Bedrock Guardrails is Amazon’s content filtering and PII detection service. It provides content filters, denied topic detection, word filters, sensitive information filters, and contextual grounding checks.For detailed setup instructions, see Set up Bedrock guardrails.

Azure AI Content Safety

Azure AI Content Safety is Microsoft’s content moderation service. AI Studio supports two Azure Content Safety guardrail types:

For detailed setup instructions, see Set up Azure Content Safety guardrails.

Guardrail modes

Select one or more modes when configuring a guardrail. You can combine modes; for example, use pre_call to check user input AND post_call to check LLM output for comprehensive protection.

Mode What it checks When to use
pre_call User input Block PII users submit, prevent prompt injection, filter harmful prompts
post_call LLM output Catch PII the LLM generates, filter inappropriate responses, verify compliance
during_call Input (parallel) Same as pre-call but with lower latency for time-sensitive apps

Pre-call mode

Executes synchronously before the LLM call. If content is blocked, the LLM is never called.

Post-call mode

Executes synchronously after the LLM generates a response.

During-call mode

Executes in parallel with the LLM call. The response is held until both the LLM and guardrail check complete.

Team scoping

By default, a guardrail applies to all teams in your organization. You can restrict a guardrail to specific teams if different teams have different compliance requirements. For example:

When a guardrail is scoped to specific teams, requests from users on other teams skip that guardrail entirely.

Scope setting Behavior
All teams (default) Guardrail runs for all requests in the organization
Selected teams Guardrail only runs for requests from users on those teams

When you create a new guardrail, it automatically applies to all agents within its configured scope—no agent reconfiguration is needed. If you delete a guardrail, agents continue to function normally but without that guardrail’s protections.

Error handling

When a guardrail blocks content, the system returns an error to the agent. The error includes:

{
  "tpe": "BadRequest",
  "errors": [\
    {\
      "description": "Content blocked by guardrail: PII detected",\
      "key": "fail.guardrail.blocked",\
      "extras": {\
        "guardrail_name": "pii-filter",\
        "entity_type": "CREDIT_CARD"\
      }\
    }\
  ],
  "extras": {}
}

Agents should handle guardrail errors gracefully and provide appropriate feedback to users. For PII blocks, consider prompting users to remove sensitive information and retry. For a complete list of guardrail error codes, see Error codes.

Best practices

Defense in depth

Layer multiple guardrails for comprehensive protection:

  1. Input filtering (Pre-call): Block malicious prompts and PII before LLM processing
  2. Output filtering (Post-call): Catch issues in LLM-generated content

Performance considerations

Guardrails add processing time to each request, so consider the latency impact when designing your guardrail strategy. This is especially important for real-time applications like chat interfaces where response time affects user experience.

For latency-sensitive applications, consider using pre-call mode for input validation to block bad requests early and avoid unnecessary LLM calls.

Streaming responses

Guardrail modes behave differently with streaming responses:

For latency-sensitive streaming applications, prefer during-call mode for input validation over post-call output checking when possible.

Provider rate limits

Rate limits depend on your guardrail provider:

Next steps