Hashlogics
Glossary

What are guardrails in AI?

Your support bot quotes a refund policy you retired last year, and nothing in the system was watching the answer on its way out.

Guardrails

Guardrails are checks that run around a language model rather than inside it. One set inspects the request before the model sees it. Another inspects the reply before a person does, then allows it, blocks it, or rewrites it to fit a policy.

There are two halves, and teams usually build only the first. Input guardrails read the request, strip personal data, refuse off-topic questions, and catch attempts to talk the model out of its instructions.

Output guardrails read the reply. Is it about our product? Does it quote a real document? Did it promise a discount nobody authorised? That second half is where the money is, because a bad answer only costs you once it has been shown to somebody.

Why it matters

The model is not the part you control

You cannot patch a model. When a reply goes wrong, there is no line of code to fix, and the same prompt may behave differently tomorrow. Guardrails give you somewhere to put the rule.

That somewhere is ordinary software. A check that a cited document id exists is a database lookup. A check that no bank detail appears in an answer is a pattern match. Both are testable, and both keep working when the model version changes underneath you.

  • 01Prompt rules bend under pressure. Code outside the model does not.
  • 02A blocked answer can be logged, counted and reviewed next week.
  • 03Swapping model providers leaves your checks intact, because they never lived in the prompt.
Where each check sitsLive
  1. RequestArrives from a person.
  2. Input checkStrip, refuse or allow.
  3. ModelThe part you cannot inspect.
  4. Output checkVerify before anyone reads it.
  5. DeliverOr block, and log why.

Only the last station decides what a customer actually sees. Teams that build the first three ship the risk anyway.

Questions, answered
01Do guardrails stop prompt injection?

They raise the cost of it without closing it. An input filter catches the obvious attempts, but instructions can arrive inside a document, a web page or a support ticket the model was asked to read. The durable defence is to limit what the system is allowed to do, so a successful injection reaches nothing valuable.

02Should guardrails be a model or plain code?

Use plain code wherever the rule can be written down. Checking an amount against your database is exact, fast and free. Keep a second model for judgement calls, such as whether an answer stayed on topic. That classifier has its own error rate, so it is a check that needs checking.

03How strict should a guardrail be?

Strict enough that the failures you block outnumber the good answers you lose. Every filter has a false-positive rate, and a system that refuses ordinary questions gets abandoned by staff who then work around it. Measure both sides before tightening a rule.

Verified
Start

Anyone can ship the agent. We answer the pager.

We build AI agents and automation, then stay on under an agreed service level. A senior engineer reads every brief, and your call gets scheduled within 24 hours.

What happens next

  1. 01

    You send a brief or book a call

    Two minutes, whichever you prefer.

  2. 02

    A senior engineer replies within 24 hours

    Not a sales rep.

  3. 03

    Honest scoping, in writing

    And if we’re not the right fit, we say so.

Abdul Basit, CEO of Hashlogics

“I started Hashlogics because too many teams ship a demo, get paid, and disappear. We build to a standard we’d run ourselves — and we stay to keep it running.”

Abdul Basit · CEO · a direct line

Not ready to talk? Take the checklist.

12 questions to ask any AI agency before you sign. They separate a demo shop from a team that ships to production.

Get the checklist

Free · no newsletter