AI agent guardrails: a production checklist

Ten checks a live agent needs, what each one stops, and how to build it. Every linked guide has code we ran before publishing.

Short answer

AI agent guardrails are checks that run in your code, outside the model, before the agent acts. A live agent needs at least: a step limit, a time limit, a spend limit, an allow list of tools, rules for risky arguments, a person's approval for actions you can't undo, a duplicate check on anything that sends or pays, a retry budget, a way to stop a run that is already going, and a record of every step.

An agent in production makes its own decisions about what to call, how often and how much to spend. Guardrails are the checks that hold no matter what it decides. They run in your code, outside the model, before the agent acts. That is the difference from a prompt: a prompt asks the model to behave, a guardrail doesn't give it the choice.

Two kinds of guardrails

  • Content guardrails check text: harmful or off-topic output, personal data, prompt injection in what the agent reads.
  • Action guardrails check what the agent does: which tools run, with which arguments, how often, for how long and at what cost.

A live agent usually needs both. This checklist covers action guardrails, because those are the ones that decide what happens to your money, your data and your customers.

The checklist

1. A step limit

Stops: Runs that never decide they are finished.

How: Count tool calls per run and end the run past a fixed number. Set your framework's own cap too. Guide: Infinite loops.

In SteerPlane: Yes: max_steps.

2. A repeat check

Stops: The same call again and again, long before the step limit.

How: Stop when the same tool is called with the same arguments more than about 3 times. Guide: Infinite loops.

In SteerPlane: Yes, by tool name. It can stop a healthy run over a list, so it can be switched off per run.

3. A time limit

Stops: Runs waiting all night on something that never comes.

How: A deadline checked before each step, plus a timeout on every call. Guide: Runs left overnight.

In SteerPlane: Yes: max_runtime_sec.

4. A spend limit per run

Stops: One run costing far more than planned.

How: Count cost from token usage and check the total before each call. Guide: Spend per run.

In SteerPlane: Yes: max_cost_usd. Through the gateway, a streaming answer is cut when the run crosses its limit.

5. A budget per customer or team

Stops: One customer or department quietly eating your margin.

How: Tag every call with who it was for and check their monthly total. Guide: Cost per customer.

In SteerPlane: Per key: give each customer or team its own key with a monthly budget.

6. Tool rules

Stops: Tools the agent should never use, and dangerous patterns like delete_*.

How: An allow list of tools, a deny list of patterns, checked in code before the call. Guide: Deleting data.

In SteerPlane: Yes: allowed_actions, denied_actions and rate limits per action.

7. Approval for what can't be undone

Stops: A refund, an email or a delete that nobody saw.

How: Hold those calls for a person, tied to the exact arguments, used once. Guide: Human approval.

In SteerPlane: Yes: require_approval with a callback that sees the arguments.

8. A duplicate check

Stops: The same email or refund twice after a retry or restart.

How: Idempotency keys, a ledger, and one claim per account and reason. Guide: Duplicate actions.

In SteerPlane: No. Use the code in the guide.

9. A retry budget

Stops: One rate limit error turning into dozens of paid retries.

How: One retry budget for the whole run, Retry-After, jitter. Guide: Retry storms.

In SteerPlane: Not the retries themselves. The step and spend limits end a run that keeps retrying.

10. A stop you can pull

Stops: A run going wrong while you watch it.

How: A stop flag outside the agent, checked before each call and each send, and a key you can revoke. Guide: Kill switch.

In SteerPlane: Yes: steerplane runs kill stops a live run at its next step.

Three rules for all of them

  • Check before, not after. A guardrail that notices a problem after the call has already spent the money or sent the email is a report, not a guardrail.
  • Fail loudly. Hitting a limit should raise an error someone hears about, not end the run quietly.
  • Test with an agent that is meant to fail. A loop, a runaway cost, a forbidden tool. If you have never seen a limit fire, you don't know that it works.

Keep a record of every step

When a guardrail fires, someone will ask what happened. Record each step of each run: the call, the arguments, the cost and which check stopped it. Without that record, a stopped run is a mystery and a missed one is invisible.

What SteerPlane does and doesn't cover

SteerPlane is a safety layer for live AI agents. It puts the action guardrails above, marked yes, around your existing agent: in your code with pip install steerplane or npm install steerplane, or as a gateway in front of the model. The rules are checked in code, so the same step always gets the same answer. It works with LangChain, CrewAI, AutoGen, the OpenAI Agents SDK, Claude Code and plain Python or TypeScript, and you can run it on your own servers.

What it doesn't do. It doesn't filter content, detect prompt injection, or check whether an answer is true. It doesn't remove duplicate actions or retry for you. Pair it with a content guardrail and the code in the duplicate and retry guides.

Setup takes a few minutes and is on the setup page. How SteerPlane compares with other tools is on the comparison page.

Questions people ask

What are guardrails for AI agents?

Checks outside the model that limit what an agent can do, spend and repeat. They run in plain code before a model call or tool call, so they hold even when the model is confused or has been tricked by text it read.

Are prompt instructions enough as guardrails?

No. A prompt asks the model to behave. The model is the part that goes wrong, so the rule has to be checked in code it cannot skip.

What is the difference between content guardrails and agent guardrails?

Content guardrails check text: harmful output, personal data, off-topic replies. Agent guardrails check actions: which tools run, with which arguments, how often, how many steps and how much money. A live agent usually needs both.

Can guardrails run on my own servers?

Yes. Every check in this guide is plain code that runs where your agent runs. SteerPlane can also be self-hosted: the SDK and the server run on your own machines.

Shipping agents? Let's talk.

Become a design partner

Our first 10 design partners get every paid feature free.

  • We wire it into one of your agents with you, usually in under an hour.
  • Sign-off requests, alerts and a full record of every run, in your own dashboard.
  • Hosted by us or on your own servers, whichever you prefer.
  • A direct line to the founders, and your requests go to the top of what we build.
  • We ask you to use it on one real agent for 4 weeks and tell us what breaks.