Telnyx - Global Communications Platform ProviderHome
Voice AI AgentsText-to-SpeechSpeech-to-TextEmbeddingsSearch APIBrowser APIMeetingBotVoice DesignInference APIAgentSDKFunctionsStateful ActorsKVSQLDBStorageGlobal NumbersVoice APISIP TrunkingSMS APIEmail APIRCSWhatsAppWebRTCVerify APINumber ReputationNumber LookupDeepfake DetectionBranded CallingIoT SIMeSIMMobile VoicePrivate Wireless GatewaysVirtual Cross ConnectsCloud VPNGlobal IP200+ open-source buildsagent-signup.mdx402View all primitivesHealthcareFinanceTravel and HospitalityLogistics and TransportationContact CenterInsuranceRetail and E-CommerceSales and MarketingServices and DiningView all solutionsVoice AIVoice APIInferenceMobile VoiceSpeech-to-TextText-to-SpeechSIP TrunkingSMS APIEmail APIWhatsApp Business APIGlobal NumbersIoT SIM CardView all pricingOur NetworkGlobal communicationsEdge ComputeAgents PlatformPartnersCareersCustomer storiesResource centerMission Control PortalEventsVoice AI agent playbookSupport centerSETIDev DocsIntegrationsCode examplesBenchmarks
Contact salesLog in
Sign up
Contact salesLog in
Sign up
Start building

Social

Compare

  • Twilio
  • Bandwidth
  • Plivo
  • Vonage
  • Wasabi
  • Amazon S3
  • ElevenLabs
  • Vapi
  • Baseten
  • Together.ai
  • Amazon Connect
  • Lumen
  • Cloudflare
  • Resend
  • SendGrid
  • Mailgun

Resources

  • Release Notes
  • Acceptable Use
  • Terms and conditions
  • Website Terms and Conditions
  • Data and Privacy
  • Report Abuse
  • Privacy Policy
  • Cookie Policy
  • Law Enforcement
  • Trust Center

Company

  • Why Telnyx
  • Our Network
  • Global Coverage
  • Customer Stories
  • Careers
  • Country Specific Requirements

Social

Company

  • Our Network
  • Global Coverage
  • Release Notes
  • Careers
  • Voice AI
  • AI Glossary
  • Shop

Legal

  • Data and Privacy
  • Report Abuse
  • Privacy Policy
  • Cookie Policy
  • Law Enforcement
  • Acceptable Use
  • Trust Center
  • Country Specific Requirements
  • Website Terms and Conditions
  • Terms and Conditions of Service

Compare

  • ElevenLabs
  • Vapi
  • Baseten
  • Together.ai
  • Twilio
  • Bandwidth
  • Vonage
  • Amazon Connect
  • Lumen
  • Cloudflare
  • Resend
  • SendGrid
  • Mailgun
Telnyx
© Telnyx LLC 2026
ISO • PCI • HIPAA • GDPR • SOC2 Type II

Ask AI

  • GPT
  • Claude
  • Perplexity
  • Gemini
  • Grok
Back to Glossary

What are AI guardrails? Types, examples, and how they work

AI guardrails are run-time checks on what goes into and comes out of an AI model. How they work, the main types, examples, and guardrails for AI agents.

Maeve Sentner
Editor: Maeve Sentner

Updated October 2026

AI guardrails are checks that run around an AI model while it is in use. They inspect what goes into the model, such as the prompt and retrieved text, and what comes out, such as the response or a tool call. Anything that breaks the developer's policy is flagged, blocked, rewritten or escalated to a person. LLM guardrails are the same checks applied to applications built on large language models.

Large language models arrive with safety training built in, yet Zou and colleagues found that an automatically generated string of text, added to the end of a harmful request, got three public chatbots past that training.

Guardrails put the final decision about what reaches a user, a database or a phone line in the application, where the developer controls it.

This content was generated with the assistance of AI. Our AI prompt chain workflow is carefully grounded and preferences .gov and .edu citations when available. All content is reviewed by a Telnyx employee to ensure accuracy, relevance, and a high standard of quality.

Sign up and start building.

Sign UpContact Us

What are AI guardrails?

An AI guardrail is a rule enforced outside the model. It has three parts: a written policy, a detector that checks each request or response against it, and an outcome, such as a block, when the detector fires.

The model cannot switch a guardrail off, because the guardrail is not part of the model. The same guardrail works with any underlying large language model.

Safety training sits inside the model: methods such as Constitutional AI change its weights so it declines harmful requests and explains why.

Prompt instructions differ from both: a system prompt asks the model to behave, while a guardrail checks whether it did.

The term also has a policy sense: in law and corporate governance, "AI guardrails" and "ethical guardrails" mean the rules for how AI may be built and used, not checks that software runs on each request.

Why do AI systems need guardrails?

AI systems need guardrails because a model's training does not reliably stop it from being manipulated, leaking data, stating false facts or taking unsafe actions.

The OWASP Top 10 for large language model applications, a ranking of the most serious security risks, puts prompt injection first and sensitive information disclosure second for 2025.

Prompt injection is input that changes the model's behavior in ways the developer did not intend.

A model can also fail with no attacker involved, by producing a hallucination: a fluent answer that is false. The US National Institute of Standards and Technology lists it, as confabulation, among 12 risks in its Generative AI Profile.

Safe AI responses come from a check matched to each risk: input checks against injection and data leakage, output checks against harmful or unsupported answers, and action checks on what an agent may do.

How do AI guardrails work?

AI guardrails work by running a detector at fixed checkpoints in an AI application and acting on what it finds. An input check runs before the model, an output check runs after it, and in an agent an action check runs before any tool executes.

Each detector looks for a policy violation and returns one of five outcomes:

  • Allow lets the request or response through unchanged.
  • Flag lets it through and logs the finding for review.
  • Block stops it, and the application returns a refusal or an error instead.
  • Rewrite changes it, for example by masking a card number, and lets the new version through.
  • Escalate hands it to a person or a stricter process, such as a human agent or a second verification step.

In a support chat, a customer pastes a card number into a refund question. A rule in the application's code masks the number before the model sees it: a rewrite.

The output check then confirms the answer promises nothing the refund policy forbids: an allow.

Behind each check is a detector of one of three kinds: rules, trained classifiers or model judges. Rules match exact patterns without a model call, such as a checksum test that finds card numbers or a list of banned phrases.

Trained classifiers sort text into risk categories. Llama Guard, for example, is a language model fine-tuned to label both prompts and responses against a safety taxonomy.

A model judge is a second language model given the policy in plain words and asked whether a prompt or response breaks it. It handles nuanced policies that no pattern or fixed category describes.

The moderation rails in NeMo Guardrails work this way: a separate model vets each user message before the main model sees it, and each response before the user does.

AI guardrails on a request's path: a prompt passes an input check before the model, the model with its safety training inside, an output check after the model, and in an agent an action check before any tool executes. A support chat runs through it: the input check masks a card number, a rewrite, and the output check finds the answer inside the refund policy, an allow. Each check returns one of five outcomes: allow, flag, block, rewrite or escalate.

Types of AI guardrails

The four main types of AI guardrails are named for what they inspect: input, output, retrieval and action guardrails.

Input guardrails

Input guardrails check what users and other systems send to the model. They catch jailbreak attempts and prompt injections, keep secrets and personal data from reaching the model provider, and turn away off-topic requests.

Output guardrails

Output guardrails check what the model produces before anyone sees it. Content filters block hate speech and other harmful categories; other checks catch leaked personal data, broken formats and claims the business may not make.

Retrieval guardrails

Retrieval guardrails check the documents a model reads, in systems that ground answers in retrieved text.

Before the model runs, one check screens retrieved passages for hidden instructions. Afterwards, another tests whether the answer follows from them.

Action guardrails

Action guardrails sit between an agent and its tools. They decide whether a proposed tool call is allowed, whether its arguments are valid, and whether a person must approve it first.

Other taxonomies sort the same checks by owner (data, model, application, infrastructure) or by purpose (security, privacy, safety, accuracy, compliance).

Examples of AI guardrails

A common example of an AI guardrail is a refund limit on a support agent. The agent issues refunds up to a set amount on its own, and anything larger waits for a person to approve it.

Three other common guardrails, with the trigger and the outcome for each:

  • A topic check on a bank's support bot declines off-topic requests, such as poems or medical advice, and offers the bot's real scope instead.
  • A grounding check compares each answer with the retrieved policy document and blocks any sentence the document does not support.
  • A brand and compliance check on AI-written marketing copy looks for banned claims, missing disclaimers and off-brand terms before anything publishes, then sends a failing draft back for revision.

Guardrails for AI agents

Guardrails for AI agents check actions as well as words, because an agent's output can call a tool that moves money, changes a record or ends a phone call.

OWASP calls the failure excessive agency and traces it to three causes: tools the agent does not need, permissions broader than the task, and high-impact actions taken without approval.

Two action guardrails answer those causes directly, and two more catch bad inputs and runaway loops:

  • Least privilege gives the agent only the tools its task needs, and each tool only the permissions its job needs.
  • Approval gates make irreversible or high-value actions wait for a person to confirm.
  • Argument checks validate each tool call's inputs, such as an account ID that must belong to the caller, before the tool runs.
  • Limits on steps, retries and spend stop an agent that loops.

On a phone call, an agent's tools act on the call itself. An agent built on a programmable Voice API can transfer, hang up or send keypad tones, so each of those tools needs its own permission check.

Agents also read content they did not write, which opens a second path for attacks. Greshake and colleagues showed that instructions planted in a web page or document can redirect an assistant that retrieves it.

The working rule is that retrieved content is data, never instructions. OWASP's prompt injection mitigations put it into practice: the application labels retrieved text as untrusted, keeps it apart from its own instructions and filters it.

Can AI guardrails be bypassed?

AI guardrails can be bypassed. OWASP's own guidance says it is unclear whether any method fully prevents prompt injection.

A rephrased jailbreak, a new language or an encoding the detector has not seen can slip past it. The adversarial suffixes that Zou and colleagues generated even worked on models they were never trained against.

A classifier or model judge is itself a model, so it can be attacked too. Mangaokar and colleagues built an adversarial prefix that carried harmful responses past several guard models, even with no access to the guard model itself.

The model's own safety training is no backstop either: Qi and colleagues fine-tuned a commercial model on 10 harmful examples, at a cost of under $0.20, and it then followed nearly any harmful instruction.

The realistic goal is layers: input, output and action checks that fail differently, logs that show what each one caught, and a person on the path for the decisions that matter most.

How to implement AI guardrails

Implementing AI guardrails starts with a written policy for each risk, then attaches a detector and an outcome to each policy at the stage where that risk enters or leaves the application.

  1. The team writes a policy for each risk: what the application must never accept, say or do, and what gets flagged instead of blocked. A bank's support bot and a coding assistant need different lists.
  2. Each risk gets the cheapest detector that reliably catches it: a rule for a fixed pattern, a classifier for a harm category, and a model judge only where the policy needs judgment.
  3. Each stage gets an outcome for a match (block, flag, rewrite or escalate) and, for a classifier, a confidence threshold before it acts.
  4. Tests run in both directions. A public attack set, such as the AdvBench prompts from Zou and colleagues, plus attacks from the application's own logs, shows what the guardrails catch; normal traffic shows what they wrongly block.
  5. Every flag and block goes in a log that records what was found, not the data itself. A team that reads the log sees where the policy is too loose or too strict, and updates it as new attack patterns appear.
  6. Changes roll out gradually, because a new rule can block traffic nobody tested. Sending a share of real traffic to the new version first, as a canary deployment, shows its effect before every user sees it.

Guardrails run in one of three places: as a library inside the application, as a separate model the team hosts and calls, or in a gateway between the application and its model provider.

A library such as NeMo Guardrails changes with the application's code. A hosted classifier such as Llama Guard adds a model call but keeps the data on the team's own servers.

A gateway such as Telnyx AI Gateway sets one policy on a group of API keys and applies it to every request those keys make.

Because it sees every prompt and response in transit, a gateway suits checks every application needs, such as blocking secrets and card numbers.

Checks that depend on the application's context, such as masking a value or keeping to a topic, sit in the application itself.

Every added check costs latency and compute. A strict one also turns away legitimate requests, which users experience as the product failing.

Comparison of three guardrail detector kinds. Rules match exact patterns without a model call, such as a checksum test that finds card numbers, and miss a rephrased attack. A trained classifier such as Llama Guard sorts text into risk categories, and a model judge such as NeMo Guardrails moderation rails reads the policy in plain words; both are models, so both add a model call and can be attacked too. Rules fit a fixed pattern, a classifier a harm category, and a model judge a policy that needs judgment.

Guardrails in voice AI agents

Guardrails in voice AI agents must finish inside the pause between a caller's question and the agent's reply, because a sentence the agent has spoken cannot be withheld.

A voice agent speaks the model's text as it arrives, so an output check that might block must hold the text until it finishes. The caller hears silence for as long as the check runs.

The guardrails in Telnyx AI Gateway show the trade-off. Buffered mode holds a streamed response until inspection completes, delaying its first words; passthrough mode sends text at once but can only flag findings after the stream ends.

One voice agent turn: the caller speaks, and a transcript passes an input check, the model and an output check before the agent speaks. In buffered mode the model's text is held until inspection completes, so the caller hears silence while the check runs. In passthrough mode the agent speaks as text arrives, and the check can only flag findings after the stream ends. The voice rule: fast, exact checks on the live path; slower judgments run alongside the call.

For voice, the working rule is to keep fast, exact checks on the live path. Slower judgments run alongside the call, as flags a person reviews later or as a signal that hands the caller to a human.

Spoken personal data is best stopped at the transcript, before it reaches a model provider. Callers read card numbers aloud, and the transcript carries them to the model.

In Telnyx's AI DLP test, AI Gateway's pattern checks blocked prompts carrying a cloud access key, a card number, an IBAN, a Social Security number, an email address and a phone number before any reached a provider.

The gateway documentation lists the limits of pattern checks. They miss names, addresses and formats outside the supported patterns.

Pattern checks also do not redact text, moderate content with a model, detect prompt injection or inspect audio. The application or a separate model has to cover those.

A required disclosure, such as a notice that the call is recorded, should never depend on the model.

In Telnyx AI Assistants, Conversation Workflows split a call into steps, and a speak node plays a fixed message word for word with no model turn. Each step can also limit the agent's tools.

A handoff to a person covers what the agent cannot resolve on its own. Telnyx's voice AI agents can transfer the call to a human when a rule fires, such as a caller asking for a manager.

Synthetic voice detection is an input check that only voice needs. A synthetic speech detector scores whether a caller's voice is machine-generated, and a high score can send the call to extra identity checks before the agent acts.

Frequently asked questions

Do chatbots like ChatGPT have guardrails?

Consumer chatbots are trained to refuse harmful requests, and the companies behind them can add guardrails outside the model. Training alone is not enough: jailbreak prompts and generated attack strings have pushed public chatbots past it.

An application built on the same model through an API gets the model's training, not the chatbot's product rules. Its own guardrails, such as which topics it covers and what data it sends, are its developer's job.

Is there an AI without guardrails?

A model run with no checks around it has no guardrails. Open-weight models can be run that way by anyone who downloads them.

The model's own safety training is a separate layer, and fine-tuning can wear it down. Qi and colleagues found that even fine-tuning on ordinary, benign data weakened a model's safety training.

Are AI guardrails the same as content moderation?

Content moderation is one job AI guardrails do, not the whole of it. Moderation classifies text into harm categories such as hate speech or violence.

Guardrails also check for leaked data, prompt injection, unsupported claims and unsafe tool calls, none of which a moderation classifier is built to catch.

How are guardrails different from alignment and steering?

Alignment trains a model to behave well, so it changes the model itself. Steering, through prompts, examples and decoding settings, directs the model's output as it is generated; the steerability page covers how far that reaches.

Guardrails check the input and output at run time and enforce the result. A prompt that tells a model to avoid a topic is steering; a check that blocks the answer when it covers the topic anyway is a guardrail.

What are the best AI guardrails?

The best AI guardrails for an application are the ones that match its own risks and hold up on its own traffic. A tool that tops a general benchmark can still miss the attacks that matter to one business.

Four measures compare options fairly: the share of real attack prompts caught, the share of normal requests wrongly blocked, the latency each check adds, and what each check logs for review.

Sources

  • Zou, A., Wang, Z., Carlini, N., Nasr, M., Kolter, J. Z., and Fredrikson, M. (2023). Universal and transferable adversarial attacks on aligned language models. arXiv:2307.15043.
  • Bai, Y., et al. (2022). Constitutional AI: harmlessness from AI feedback. arXiv:2212.08073.
  • Rebedea, T., Dinu, R., Sreedhar, M. N., Parisien, C., and Cohen, J. (2023). NeMo Guardrails: a toolkit for controllable and safe LLM applications with programmable rails. EMNLP 2023 System Demonstrations.
  • Inan, H., et al. (2023). Llama Guard: LLM-based input-output safeguard for human-AI conversations. arXiv:2312.06674.
  • Greshake, K., Abdelnabi, S., Mishra, S., Endres, C., Holz, T., and Fritz, M. (2023). Not what you've signed up for: compromising real-world LLM-integrated applications with indirect prompt injection. AISec 2023.
  • Mangaokar, N., Hooda, A., Choi, J., Chandrashekaran, S., Fawaz, K., Jha, S., and Prakash, A. (2024). PRP: propagating universal perturbations to attack large language model guard-rails. arXiv:2402.15911.
  • Qi, X., Zeng, Y., Xie, T., Chen, P.-Y., Jia, R., Mittal, P., and Henderson, P. (2023). Fine-tuning aligned language models compromises safety, even when users do not intend to! ICLR 2024.
  • OWASP Gen AI Security Project. OWASP Top 10 for LLM applications 2025: LLM01 prompt injection and .
  • National Institute of Standards and Technology (2024). Artificial Intelligence Risk Management Framework: Generative Artificial Intelligence Profile (NIST AI 600-1).
  • Telnyx. AI Gateway guardrails. Telnyx developer documentation.
  • Telnyx. AI Assistants: Conversation Workflows and agent handoff. Telnyx developer documentation.
Share on Social

Jump to:

What are AI guardrails?Why do AI systems need guardrails?How do AI guardrails work?Types of AI guardrailsExamples of AI guardrailsGuardrails for AI agentsCan AI guardrails be bypassed?How to implement AI guardrailsGuardrails in voice AI agentsFrequently asked questionsSources

Sign up for emails of our latest articles and news

LLM06 excessive agency