Cookies on softitland.com

We use essential storage to run this site. With your permission we would also like to use analytics cookies to see which pages help visitors, and marketing cookies to measure our ads. You can change your choice at any time with “Cookie settings” in the footer. Privacy Policy

AI & automation

Guardrails for AI agents that take actions: permissions, approvals and logs

What an AI agent needs before it sends emails, updates your CRM or issues refunds: scoped access, approvals, limits in code, action logs and a kill switch.

Cover image for the article Guardrails for AI agents that take actions: permissions, approvals and logs
Key takeaways
  • Give an AI agent only the tools and permissions its task needs: its own account, read-only first, then a few narrow write actions.
  • Sends, payments, refunds and deletions should wait for a person to approve the exact action the agent proposes.
  • Put caps, rate limits and allow-lists in code, because a model can be confused or manipulated into ignoring rules in its prompt.
  • Treat every email, web page and document the agent reads as untrusted input that may contain instructions.
  • Log every tool call with its inputs and results, keep a kill switch, and run the agent in shadow mode before it acts for real.

What controls does an AI agent need before it can take actions?

Give it only the tools and permissions its task needs, make a person approve anything that sends, pays, refunds or deletes, enforce limits in code rather than in the prompt, treat everything it reads as untrusted, log every action, and keep a switch that stops it at once. Before it acts for real, run it in shadow mode, where it proposes actions and nothing happens.

A chatbot that answers can say something wrong. An agent that acts can do something wrong: email the wrong customer, refund the wrong order or overwrite a good CRM record. This guide covers controls on actions; for controls on what an assistant says, see our guide to chatbots that answer from your own content.

Why is an agent that acts riskier than one that answers?

The OWASP Top 10 for LLM Applications 2025 calls this risk LLM06 Excessive Agency: damaging actions taken in response to unexpected, ambiguous or manipulated model output. It names three typical root causes: excessive functionality, excessive permissions and excessive autonomy. Triggers include plain hallucination as well as prompt injection.

The useful part: with Anthropic's API, for example, the model returns a structured tool call and your application runs it. Every action passes through code you control, so that is where the checks belong. Anthropic's guidance on building agents also warns of "the potential for compounding errors" and recommends extensive testing in sandboxed environments.

Which tools and permissions should the agent get?

OWASP's first mitigations are to give the agent only the tools, functions and permissions it needs. In practice:

  • Its own account or API key, never an admin key or a staff login, so you can scope, watch and revoke it alone.
  • Read-only first. Many useful agents only read, classify and draft. Add write access one narrow action at a time.
  • Narrow actions, not general ones. "Create a draft reply", not "send email". "Add a note to this deal", not "edit any record".
  • No open-ended tools such as "run a shell command" or "fetch a URL" when a specific tool would do, and remove tools left over from testing.
ActionWhat can go wrongControl
Read and sort the inboxAn email carries hidden instructionsRead-only scope; no send tool in the same agent
Reply to customersWrong recipient or a promise you cannot keepDrafts only, or a recipient allow-list
Update the CRMGood data is overwrittenNamed fields only; old values kept in the log
Book appointmentsDouble bookings or mass cancellationsSet calendars only; a cap on changes per hour
Refunds and order changesMoney leaves the businessApproval above a cap set in code; a daily total
Deleting recordsData is lostNo delete tool; archive, or approve every time

How should an approval step work?

OWASP recommends that a person approves high-impact actions before they run. The Model Context Protocol specification says hosts must obtain explicit user consent before invoking any tool, and says there should always be a human in the loop with the ability to deny tool invocations. How you build the approval matters:

  • It lives outside the model. The agent submits a proposed action to a queue; your code runs it only after approval, and the agent cannot approve its own requests.
  • The approver sees the exact action: the tool, its inputs and the record it will change, not the agent's summary. MCP likewise says clients should show tool inputs to the user before calling the server.
  • Approve, edit or reject, with edits and rejections logged to show where the agent goes wrong.
  • Approvals expire, so last week's approved refund cannot run against an order that has since changed.

Why should limits live in code, not in the prompt?

"Never refund more than a set amount" in a prompt is a request, not a control; a confused model or injected text can override it. OWASP's answer is complete mediation: implement authorization in downstream systems rather than letting the model decide whether an action is allowed. Enforce these in the tool code or the system behind it:

  • Amount caps per action and per day for refunds, discounts and credits.
  • Rate limits on every write tool. OWASP notes they limit bad actions per period and buy time to notice; the MCP spec says servers must rate limit tool invocations.
  • Allow-lists of recipients, domains, calendars and fields.
  • Input validation against a strict schema. Anthropic's strict tool use makes tool inputs match your JSON schema, and your code still checks the values.
  • Stopping conditions, such as a maximum number of steps per task, plus a timeout on each tool call.

Simple versions fit inside an automation platform as filters and approval steps, which our workflow automation team builds. Higher volumes or money movements justify custom software between the agent and your systems that enforces every rule.

How can an email or web page hijack an agent?

Through indirect prompt injection. OWASP's LLM01 Prompt Injection entry describes input from external sources, such as websites or files, that alters the model's behaviour when it reads them, even when a person cannot see the instructions. OWASP says it is unclear whether fool-proof prevention exists, so design as if it will sometimes work.

OWASP's own example: an assistant that summarises a mailbox also has a send function, and a crafted email tricks it into forwarding sensitive information to an attacker. The fixes are a read-only tool, a read-only OAuth scope and a person who sends every draft.

  • Separate reading from acting. An agent processing outside emails, pages or documents should not hold powerful write tools in the same step.
  • Mark outside content as data, as OWASP recommends, and never let it change the target: recipients, amounts and accounts come from your records.
  • Vet third-party tools. The MCP spec treats tool descriptions as untrusted unless they come from a trusted server.
  • Test it before launch with emails and files that hide instructions, as part of the test set in our guide to testing an AI assistant before launch.

What should an agent's action log record?

OWASP lists logging and monitoring as a way to limit damage, and the MCP spec says clients should log tool usage for audit purposes. For each tool call, record the time, the agent version (model, prompt and tools), what triggered it and what it read, the tool name with full inputs and result, before and after values of changed records, and who approved it.

Store the log where the agent cannot edit it, and alert on unusual patterns such as a burst of writes. Inputs can include personal data, so protect and expire these logs as described in our guide to keeping customer data safe with AI APIs.

How do you stop an agent quickly when something goes wrong?

Add a kill switch: one setting your code checks before every tool call, able to pause all actions or a single tool. Because the agent has its own accounts, you can revoke its keys without locking out staff, and the before values in the log let you reverse changes. Decide who may flip it, and practise once before launch.

How should you roll out an agent that takes actions?

  1. Shadow mode. The agent runs on real inputs but only records what it would do. Compare it with what your team did.
  2. Approve everything, using sandbox or test accounts where your systems offer them.
  3. Relax approvals for low-risk actions only, inside caps and allow-lists, once edits are rare. Payments, large refunds, deletions and bulk sends keep theirs.
  4. Repeat shadow mode after any change to the model, prompt or tools.

This is how we build agents in our AI automation work: narrow tools, approvals and limits in code, full logs and a switch that stops everything.

Frequently asked questions

Do agents built in Make, Zapier or n8n need the same guardrails?

Yes. A connection in an automation platform usually acts with the access of the account that authorised it, so connect a dedicated account with narrow permissions, not an owner login. Add filters for caps and allow-lists, an approval step before sends and payments, and keep the run history.

Who should approve an agent's actions?

The person who would own the action if it were done by hand: support leads for customer replies, finance for refunds, sales for deal changes. Send approvals to a tool they already use, such as email, chat or a CRM task, and name a backup so requests do not stall.

Does adding approvals defeat the point of an AI agent?

No. The agent still does the slow part: reading the request, finding the customer, checking the order and preparing the exact action. The person only confirms. Once the logs show an action type is reliably right, you can drop its approval and keep approvals where mistakes cost money or trust.

Which AI model is safest for an agent that takes actions?

The controls around the model matter more than the choice of model, because OWASP says it is unclear whether prompt injection can be fully prevented. Prefer a model and API that follow your tool schemas reliably, then test shortlisted models on your real tasks and compare how often their proposed actions need editing.

How often should we review an agent's permissions?

Whenever you add a tool, change the task, connect a new system or someone with access leaves, and on a fixed schedule as well, such as every quarter. Compare what the agent is allowed to do with what the logs show it actually uses, and remove the rest.

Last updated

Start a project

Have a project in mind? Let’s build it.

Tell us what you need. You get a clear plan, a fixed quote and a timeline before any work starts.

Prefer email? info@softitland.com