AI agent guardrails: the technical limits that keep an agent safe
Start with least-privilege access
Give the agent the smallest set of permissions that lets it do its job. An agent that summarises support tickets does not need access to payroll, and an agent that drafts replies does not need permission to send them. Create a separate service account for each agent rather than reusing a staff member's login, so its actions can be traced and revoked on their own.
Check the access in your platform's admin settings, not in your memory of what you set up. Scopes often build up as integrations are added. Review them on a fixed schedule and remove anything the current task no longer uses.
Separate read access from write access
Most serious incidents come from write access, not read access. Let the agent read widely if the task needs context, but keep write permissions narrow: one folder, one CRM object type, one set of labels. A read-only agent can still produce a poor summary, but it cannot change a customer record.
Apply the same split to every tool. Grant read access only to the data the task needs, and write access only to the fields or folders the workflow actually writes. Where possible, have the agent write to a draft or staging state so a person can check the result before it goes live.
- Never give delete permission unless you have a tested restore process.
- Use a staging area or draft state for writes that customers or finance will see.
- Review write scopes whenever a new tool is connected.
Allow-list tools, domains and recipients
An agent should only call the tools you have listed. Enforce this in the tool layer, so a request for an unlisted tool fails, rather than relying on the prompt to say no. The same rule applies to outbound destinations: list the domains it may fetch from, and the email addresses or chat channels it may message.
Recipient allow-lists matter most for email and messaging. A simple rule that only allows sends to contacts already in the CRM, or to your own domain, stops a misread address from reaching a stranger. Keep the list short, and review it when your customers or suppliers change.
Set step, time and spend limits
A looping agent can repeat a step many times and run up model and tool costs before anyone notices. Set a maximum number of steps per task, a time limit per run and a spending cap at the model provider. When a limit is reached, the agent stops, saves its state and reports to a person.
Retry logic needs the same care. If a tool call fails for a reason the agent cannot fix, resending the identical request will fail again. Build the agent to change its request or stop, and to count its retries against the step limit.
- A maximum number of steps per task, so repeated tool calls end the run.
- A timeout on each tool call, so a slow system cannot hold the agent open.
- A spending cap set in the model provider's billing console.
- A retry limit that changes the request or stops the run.
Build a kill switch and clear stop conditions
You need a way to stop an agent in seconds, without waiting for a developer. The simplest version is a flag in a settings table or a switch in the admin panel that the agent checks before every action. Use it to pause a runaway process, and also when a source system is down or returns data that looks wrong.
Define stop conditions in advance. For example, stop when a record fails validation, when two tool calls return errors in a row, or when the agent is asked to act outside its allow-list. A stopped agent should leave a clear note explaining why it stopped, so the next person knows what to check.
Test that each limit actually fires
A guardrail you have never triggered is a guess. For every limit, write a test that deliberately breaks the rule: request an unlisted tool, send to an address that is not allowed, force a loop, exceed the step limit and flip the kill switch. Confirm that each one stops the run and writes a log entry.
Run these tests after every change to prompts, tools or permissions, not only at launch. Keep the results with the agent's documentation, so you can show that the controls worked and when they were last checked.
How Hundred Seas helps
Hundred Seas is a product studio in Taipei that builds AI agents on Claude and on OpenAI models. We set permissions, tool allow-lists, spending caps and kill switches as part of the build rather than as an afterthought, and we choose each model on cost, speed, quality and where the client's data has to stay.
A project with us begins with a scope step of about one week at a fixed price, ending in a written plan, a clickable prototype and a firm quote. The build takes two to four weeks in weekly releases of working software, and a monthly run plan keeps the limits reviewed and the software updated.
Questions
- What is a guardrail for an AI agent?
- A guardrail is a technical limit that the agent cannot override by reasoning. Examples include a permission that blocks a write, an allow-list of recipients, a step limit and a kill switch. Instructions in the prompt help the agent behave well, but a guardrail enforces the boundary even when the prompt fails.
- Are prompt instructions enough to keep an agent safe?
- No. A model can misread an instruction, or be steered by content it reads, such as a message that contains hidden directions. Enforce critical rules in code or platform settings, and use the prompt for tone, role and the steps you want followed.
- What is the first guardrail a small team should set up?
- Start with least-privilege access. Give each agent its own account, with read access to what it needs and write access to one narrow area. Then add a spending cap at the model provider and a step limit. These three cover much of the early risk.
- How do I test an AI agent's guardrails?
- Write tests that deliberately break each rule: an unlisted tool call, a send to an outside address, a repeated loop and a flipped kill switch. Each test should pass only if the run stops and logs the reason. Repeat the tests after every change to the agent.
- Should an agent ever be allowed to delete data?
- Only when the deletion can be reversed, the restore process has been tested and the scope is narrow. For most business agents, archiving or flagging records is safer than deleting them. Check your own retention and privacy obligations before you allow any permanent deletion.