TheWavly

The gap

Asking is optional. Guarding is not.

Most safeguards for agents are instructions: check the cart, confirm with the user, call this tool first. Instructions are exactly what a prompt-injected agent stops following.

Advisory

The agent is told to check

  1. A listing tells the agent to choose it now.
  2. The agent skips the check and calls place_order.
  3. The server places the order.

The order cannot be cancelled.

With TheWavly Guard

The tool itself is guarded

  1. The agent calls place_order, skipping any check.
  2. The Guard holds the call, reads view_cart, and asks TheWavly.
  3. TheWavly answers stop or ask, so the server never sees the call.

Nothing is ordered until it matches what the user approved.

Replay

Quoted ₹475. Billed ₹561.

A public report described two shakes quoted at ₹475 and billed at ₹561. Our demo server reproduces it, and the user approved up to ₹500.

1₹475

The menu shows two shakes for ₹475, without fees.

2place_order

The agent orders straight away, without checking anything.

3₹561

The Guard reads the shop’s own cart: ₹475 plus ₹86 in fees.

4Ask the user

₹561 is over the ₹500 the user approved. TheWavly sends them a link.

5Then, and only then

Once they approve that exact order, the same call goes through, with a receipt.

TheWavly’s answerWhat the Guard does
ProceedLets the call through, reports the outcome to TheWavly, and adds a receipt link the user can verify.
AskDoes not make the call. Gives the agent the user’s approval link. The same order goes through once the user approves it; a changed cart needs a new answer.
StopDoes not make the call, and tells the agent not to retry. For example, a seller the user did not name.

Set up

One command in front of your server.

No change to your MCP server. Name the tools that place orders, say where the total is, and start the Guard in front of it. Or wrap your handler in code.

Download the SDK bundle and extract it in your project directory. Node 20 or newer is required. Run the extracted Guard directly:

curl -fL https://thewavly.com/sdk/thewavly-open.tar.gz -o thewavly-open.tar.gz
tar -xzf thewavly-open.tar.gz
WAVLY_API_KEY=sk_test_… WAVLY_MANDATE=mdt_… \
  node ./thewavly-open/sdk/guard/cli.mjs --config guard.json -- node shop-server.mjs
{ "tools": { "place_order": {
  "resolve": { "tool": "view_cart",
    "arguments": { "cart_id": "args.cart_id" } },
  "purchase": { "item": { "const": "Food order" },
    "amount_rupees": "resolved.total_rupees",
    "merchant": "resolved.store", "payee": "resolved.upi_id" },
  "reference": "result.order_id" } } }
The mandate is yours, not the agent’sThe Guard takes it from your configuration. An agent cannot point it at a looser one.
The amount is the shop’sIt reads your own cart or bill before the order, so a quote that leaves out fees cannot slip through.
It fails closedIf it cannot read the order or reach TheWavly, nothing is ordered. Every answer is a signed record.

Agent frameworks

No MCP server? Guard the function that pays.

Your agent’s payment tool runs a function. Wrap that function and give the wrapped one to your framework. The model sees the same tool, and the payment runs only when TheWavly says proceed, or after the user approves.

// First: npm install ./thewavly-open/sdk/guard
import { guardFunction } from "@thewavly/guard";
const execute = guardFunction(
  ({ cart_id }) => shop.placeOrder(cart_id),
  { wavly, mandate: process.env.WAVLY_MANDATE,
    purchase: async ({ cart_id }) => {
      const cart = await shop.cart(cart_id);
      return { item: "Food order",
        amount_paise: cart.total_paise,
        merchant: cart.store, payee: cart.upi_id };
    },
    reference: order => order.order_id });
# First: python3 -m pip install ./thewavly-open/sdk/python
from thewavly.guard import guard
@tool   # or @function_tool
@guard(wavly, mandate=os.environ["WAVLY_MANDATE"],
       purchase=shop.cart_purchase,
       reference=lambda order, *a, **k: order["order_id"])
def place_order(cart_id: str) -> dict:
    """Place the order for a cart and pay for it."""
    return shop.place_order(cart_id)
FrameworkHow
Vercel AI SDKThe guarded function is the tool’s execute.
LangChain and LangGraph, JavaScript and PythonWrap the function inside the tool. In Python, put @guard under @tool; the tool keeps its name, arguments and description.
OpenAI Agents SDK, JavaScript and PythonThe guarded function is the tool’s execute, or put @guard under @function_tool.
Your own loopCall the guarded function instead of the real one. Sync and async both work.

Each of the five integrations above is run through the same steps: a payee the user never named is stopped, the ₹561 cart is held for the user, and after approval the same call places the order. When the payment is not made, the tool returns the answer, the reason and the approval link for the agent to act on.