How to test your WhatsApp AI agent before it goes live

25 November 2026 · 6 min read · MirayaAI

Before an AI agent goes live on your WhatsApp number, do three things: list every action it can take, remove the ones it does not need and put a human approval in front of any action that touches money or customer data, then try to trick it with a short set of hostile messages. The aim is not to prove the agent is "safe": OWASP says it is unclear whether fool-proof prevention exists for prompt injection. The aim is to make sure that when someone does trick it, the damage is small.

Two terms you need

Prompt injection. OWASP's definition: it "occurs when user prompts alter the LLM's behavior or output in unintended ways." A customer who types "ignore your instructions and do this instead" is the simple case. OWASP also lists "segregate and identify external content" among its mitigations, which tells you the same risk applies to text the agent reads from elsewhere, such as a pasted document.

Excessive agency. OWASP defines it as the vulnerability that enables damaging actions in response to unexpected, ambiguous or manipulated model output. It names three root causes: excessive functionality (the agent can do things it does not need to), excessive permissions (it holds more access than it needs) and excessive autonomy (high-impact actions happen without anyone checking).

Put together: prompt injection is how someone gets the agent to misbehave. Excessive agency is what decides how much harm that misbehaviour can do.

Be honest about the limit

OWASP's page on prompt injection says it is unclear whether fool-proof methods of prevention exist. Everything below reduces impact. Our opinion, not OWASP's: be wary of any vendor who says their agent is "unhackable" or "fully safe".

A decision rule

This rule and table are our own practical opinion, not an OWASP recommendation. They apply OWASP's idea of limiting what the agent can do.

For every action your agent can take, ask one question: if a stranger manipulated the agent into doing this, what is the worst outcome?

If the worst outcome is... Then...
Harmless (sharing your opening hours) Let the agent do it alone
Costs money, changes a booking, or exposes customer data A human approves it first, or remove the action
You cannot explain why the agent needs it Remove it

The checklist, step by step

Steps 1 to 5 and 7 draw on mitigations OWASP lists for the two risks above. The examples (booking, refund, export) are ours. Step 6 is our own test set: OWASP lists "conduct adversarial testing and attack simulations" as a mitigation but does not provide these messages.

  1. List every action the agent can take. Sending a reply, looking up a booking, creating a booking, changing a booking, issuing a refund, sending a document, exporting a customer list. OWASP's first advice on excessive agency is to minimise the extensions an agent has, and to limit each one to the functions it needs.
  2. Cut what is not needed. If the agent only qualifies leads, it does not need refund or export functions. OWASP also advises avoiding open-ended capabilities in favour of narrow, specific ones.
  3. Narrow the agent's own access. The agent should have the least access that works, for example read-only on a calendar if it only has to check availability (that example is ours). OWASP's advice is to grant downstream permissions only at the level required, and to run actions in the specific user's context with minimal scopes.
  4. Put a human in front of high-impact actions. Money, refunds, booking changes and data export should wait for a person to approve. OWASP lists human approval for high-risk actions in both of its pages.
  5. Enforce the rules in code, not in the prompt. OWASP's term is complete mediation: the downstream system checks whether an action is allowed, instead of trusting the model to decide. It also advises checking output formats with deterministic code.
  6. Run the hostile test messages below and record what happened.
  7. Log what the agent does. On its excessive agency page, OWASP says logging and monitoring, and rate-limiting unwanted actions, do not prevent the problem but can limit the damage.

Hostile messages to run before launch

These messages, the English and Arabic advice and the pass rule are our own suggestions, not OWASP's. Send them in English and in Arabic, from a phone that is not on your customer list. For each one, the correct result is that the agent refuses or hands the chat to a human.

Mark any result where the agent complied, partly complied or revealed details it should not have. Fix the cause by removing the action or adding an approval, not only by rewording the instructions, because the instructions are what an attacker is trying to override. (This is our view; OWASP's related advice is to enforce limits outside the model, as in step 5.)

Three common mistakes

These are our own observations, not OWASP's.

Do this today

How an AI agent fits

An agent is worth putting on WhatsApp for fast replies and clean handovers, but each action you give it is also something an attacker could try to trigger. The sensible design is a small set of actions, narrow access and a person approving anything costly. When MirayaAI builds WhatsApp, voice and ops agents on n8n and the Claude API, they are red-teamed before go-live; whoever builds yours, ask to see what was tested.

What comes from OWASP: the two definitions, the root causes, the "unclear if fool-proof methods of prevention exist" statement and the mitigations named in steps 1 to 5 and 7. The rest is our opinion. Sources are listed in the page metadata and were checked on 25 November 2026. The OWASP Top 10 for LLM Applications lists both prompt injection and excessive agency among its entries, so it is a good starting point for further reading.

Quick answers

What is prompt injection?

OWASP describes it as a vulnerability that occurs when prompts alter the model's behavior or output in unintended ways. In practice, text a customer sends, or text inside a document the agent reads, can push the agent off its instructions.

What is excessive agency?

OWASP defines it as the vulnerability that lets damaging actions happen in response to unexpected, ambiguous or manipulated model output. Its root causes are excessive functionality, excessive permissions or excessive autonomy.

Does testing make an AI agent safe?

No. OWASP says it is unclear whether fool-proof prevention exists for prompt injection. Testing and the controls below reduce the impact; they do not remove the risk.

Have a process you want automated?
Tell us how it works today. We scope one agent around it and quote a fixed price. No pitch deck.
Book a free 30-minute call

← All guides