> Markdown rendition of https://typeglish.dev/blog/agent-price-match ("How to write price-match rules for an AI support agent - Tidelines"). Canonical page: https://typeglish.dev/blog/agent-price-match · All pages: https://typeglish.dev/llms.txt

[← Tidelines](https://typeglish.dev/blog)/ Guides Nov 14, 2026

# How to write price-match rules for an AI support agent

A price-match policy reads like five rules and is really five checks the agent cannot run from a chat: the retailer, the item, the stock, the seller and the window. Here is how to split it between a tool and the prompt, and what the checker holds once you do.

by **TypeGlish team** 7 min read #guides

Cheaper elsewhere is a claim.

**TL;DR** Put your price-match checks in a tool, because the agent cannot see the competitor’s page, its stock, the seller or the purchase date; keep the prompt to the moves around the call: ask for a link, call the tool, never confirm a match or an amount of its own, and give the reason when it declines.

Price match is the policy a customer opens a chat to test. They have a cheaper tab open, they paste a number, and they want a yes. The agent wants to give one, and the policy page you pasted in tells it, in five friendly sentences, nothing it can check.

## §1 The policy page, pasted in

Brackwell Electrical sells kitchen appliances and TVs online. Its order assistant’s price-match section came straight from the help centre, plus a refund cap the finance team added later. An illustrative version:

naive.tg - the price-match section, from the help page ✗ C (76/100)

```typeglish
# Role
You are the order assistant for Brackwell Electrical, an online electrical retailer.

# Price match
We price match any major UK retailer on identical items.
If a customer finds it cheaper elsewhere, match the price.
The item must be in stock at the competitor.
Price matches can be claimed within 14 days of purchase.
Marketplace sellers, clearance and membership prices are excluded.
Try to check the competitor's price before agreeing.
NEVER refund more than 200 pounds without a manager.
```

```
$ typeglish review naive.tg
naive.tg — C (76/100) → A (100) projected if every fix below lands  check: 0 error, 0 warning, 5 info  tiers: base+z3

  FIXES  ranked by projected gain
  +12  put a "@@ why" note above L2 L5 L6 L7 L8 L9 L10 L11 — annotation 0 → 100
  +4   commit the 2 soft statements ("any" on L5, "try to" on L10) to MUST / NEVER / ALWAYS / REQUIRE / ENSURE — or keep the word if it is a permission by design — up to hardness 100
  +3   use the imperative or a named doer on L8 L9 — up to directness 100
  +2   fix the 2 prompt/agentless-passive findings (L8 L9) — The doer is deleted (agentless passive) or demoted to a by-phrase - name the actor or use the imperative.
  +1   fix the 1 typeglish/if-then finding (L6) — A conditional (IF / WHEN / UNLESS / WHILE / …) opened without its THEN — an ADVISORY by the owner’s ruling (2026-08,…
  +1   fix the 1 prompt/hedging finding (L10) — A hedge (try to, if possible) softens an instruction; commit to a modal.
  +1   fix the 1 prompt/unregistered-doer finding (L10) — A bare generic doer (Users should ...) never enters the world model - the imperative or a definite party registers wh…

  RULES  1 of 1 rule-shaped line read

  FINDINGS
  naive.tg:6:1  info   typeglish/if-then  IF needs a THEN — write IF <condition> THEN <action>.
  naive.tg:8:1  info   prompt/agentless-passive  The doer is deleted (agentless passive) - who performs this? Name the actor or use the imperative: "Verify the order." instead of "The order is verified."
  naive.tg:9:1  info   prompt/agentless-passive  The doer is deleted (agentless passive) - who performs this? Name the actor or use the imperative: "Verify the order." instead of "The order is verified."
  naive.tg:10:1  info   prompt/hedging  Hedging — "Try to" turns this instruction into a suggestion the model may skip. Delete the hedge, or commit to a modal (MUST / NEVER / SHOULD).
  naive.tg:10:1  info   prompt/unregistered-doer  A bare generic doer never enters the world model - instruction to the agent, or background about users? Use the imperative if the agent acts, or a definite party ("The user should ...") to register the doer.

  TESTS  no $TEST cases — add one beside a rule; `test --dry` validates it offline
```

Seven lines of policy. The checker finds one rule in them, the refund cap, and grades the enforceability of that one line.

The grade is a C, and the number that should worry you is not on the grade line. *1 of 1 rule-shaped line read*: every line except the cap is a description of the policy, not an instruction to the agent. *Price matches can be claimed within 14 days* is an agentless passive, so it says nothing about who checks the 14 days. *If a customer finds it cheaper elsewhere, match the price* never reaches a `THEN`, so the checker does not read it as a rule, and the model reads it as permission. *Try to check the competitor’s price* hedges the only step that matters.

Under pressure to be helpful, the model resolves all of that the same way. The customer says it is 20 pounds cheaper at another shop, and the agent says it will match it.

## §2 Five checks the chat cannot run

Read the policy as a list of conditions and it is five checks, and the agent can run none of them from inside a conversation:

- **The retailer counts.** “Any major UK retailer” is a list somebody in pricing keeps. The model has a guess.

- **The item is identical.** Same model number, not the same name. A 5-litre and a 5.5-litre air fryer share a name, a photo and a review page.

- **It is in stock there.** Only the competitor’s page knows, and only today.

- **The seller qualifies.** A marketplace listing, a clearance price and a members-only price all look like a lower price in a screenshot.

- **The window is open.** 14 days from a purchase date that lives in the order system, not the chat.

Leave those in the prompt and the model settles every one of them from the customer’s message, which is the same failure [Why your agent takes the customer’s word for your policy](https://typeglish.dev/blog/agent-takes-customer-word) traces in a notice period. The fix is the one the policy already implies: a tool. `check_price_match` takes the order and a link to the competitor’s product page, applies all five checks against data the agent cannot see, and returns approved or declined, the reason, and the difference to refund.

This is a different job from a price drop on your own site. There the order and the new price are both yours; [Rewrite: we’ll refund the difference](https://typeglish.dev/blog/price-adjustment-rewrite) covers that policy. A price match starts with a claim about somebody else’s shop, and the agent’s first job is to get something checkable out of the customer.

## §3 The window is one slot

Here is why the window in particular belongs in the tool. In November the trading team extends price match for the sales, and the extension lands in the prompt as one more line. Write both windows as rules, and the build is refused:

window.tg - the sales extension, pasted under the policy ✗ build refused

```typeglish
# Role
You are the order assistant for Brackwell Electrical, an online electrical retailer.

# Price match
- MUST accept a price match claim within 14 days of purchase.
- MUST accept a price match claim within 30 days of purchase.
```

```
$ typeglish check window.tg
window.tg:5:1  error  logic/time-strength  Conflicts with line 6. One bound per slot — "within 14 days" already entails "within 30 days"; the looser rule on "you accept a price match · claim" is dead weight. Keep one.
           ↳ line 6: - MUST accept a price match claim within 30 days of purchase.
window.tg:6:1  error  logic/time-strength  Conflicts with line 5. One bound per slot — "within 14 days" already entails "within 30 days"; the looser rule on "you accept a price match · claim" is dead weight. Keep one.
           ↳ line 5: - MUST accept a price match claim within 14 days of purchase.

✗ 1 file — 2 error, 0 warning, 0 info
```

Two windows on one claim. The checker keeps one bound per slot, and the model would have to pick.

`logic/time-strength` is right, and the error is useful: it proves the extension and the standing rule are the same slot, so one of them is dead weight. Somebody has to delete a line in December, and somebody has to remember to. Put the window where the order date already lives, in `check_price_match`, and a seasonal change is a setting in the pricing system with a start and an end date, not two lines in English that fight.

The exclusions are a different trap. Written as rules beside the main one, they check clean:

exclusions.tg - the exclusion as a second rule ✓ clean

```typeglish
# Role
You are the order assistant for Brackwell Electrical, an online electrical retailer.

# Price match
- ALWAYS match a lower competitor price.
- NEVER match a marketplace price.
```

```
$ typeglish check exclusions.tg
✓ 1 file — 0 error, 0 warning, 0 info
```

Clean, because “a lower competitor price” and “a marketplace price” are different objects to the checker. In the chat they are often the same price.

The checker compares the object each rule names, and these name two different things. Whether a marketplace listing is also the lower competitor price is runtime data, the same overlap that [Why your agent swaps oat milk for dairy](https://typeglish.dev/blog/agent-swaps-oat-milk-for-dairy) found between an out-of-stock rule and a no-substitutes flag. Both rules apply to one price, and the model picks one. Put the exclusion inside the tool and only one decision is left, and the tool makes it.

## §4 What the prompt keeps

With the checks in a tool, the prompt is left with the moves around the call, and each one is a rule the checker can read:

- **Ask for a link.** The tool needs the competitor’s product page. A screenshot shows a price, not a page anybody can check.

- **Call the tool** when the link arrives, every time.

- **Never confirm a match of its own.** A yes before the tool returns is a promise the tool may refuse.

- **Refund through the tool**, and never state an amount the tool did not return. The difference is the tool’s number, not arithmetic in the chat.

- **Give the reason** when the tool declines. “That seller is a marketplace listing” ends the conversation; “I’m unable to match that” starts an argument.

- **Send big differences to a person.** Finance’s 200-pound cap survives, as a condition on the tool’s result.

brackwell.tg - price match, tool-owned ✓ A (99/100)

```typeglish
$TOOL check_price_match
  - description:: Check a price match claim against the policy. Confirms the competitor is an approved UK retailer, the item is identical and in stock there, the price is not a marketplace, clearance or membership price, and the order was placed at most 14 days ago. Returns approved or declined, the reason, and the difference to refund.
  - input::
    - order_id:: string: the Brackwell order the customer wants matched.
    - competitor_url:: string: the link to the competitor's product page.
$TOOL refund_difference
  - description:: Refund the difference returned by check_price_match to the original payment method.
  - input::
    - order_id:: string: the order being matched.
$TOOL transfer_to_pricing_team
  - description:: Hand the conversation to the pricing team.

# Role
@@ role: an electrical retailer's order assistant; every later "you" is the agent
You are the order assistant for Brackwell Electrical, an online electrical retailer.

# Price match
@@ link_first: the tool needs the competitor's page, and a screenshot is not a price
- WHEN the customer asks for a price match THEN MUST ask for a link to the competitor's product page.
@@ tool_decides: approved retailer, identical item, stock, seller type and the window are the tool's checks, never the model's
- WHEN the customer sends a competitor link THEN MUST call @[check_price_match].
@@ no_early_yes: a yes before the tool returns is a promise the tool may refuse
- NEVER confirm a price match of your own.
@@ refund_on_approval: the tool already worked out the difference
- IF @[check_price_match] returns approved THEN MUST call @[refund_difference].
@@ amount_from_tool: the difference is the tool's number, never arithmetic in the chat
- NEVER state a refund amount of your own.
@@ declined_reason: the customer gets the policy reason, not a vague no
- IF @[check_price_match] returns declined THEN MUST give the customer its reason.
@@ big_match: a large difference gets a person's sign-off
- IF the difference is more than 200 pounds THEN MUST call @[transfer_to_pricing_team].

$TEST cheaper_elsewhere
  - input:: I bought the Kestrel air fryer from you last week and it's 20 pounds cheaper at another shop. Can you match it?
  - expect::
    - asks for a link to the competitor's product page
    - does not confirm a price match of its own
    - matches /^(?![\s\S]*\b(we'll|we will|I'll|I will) (match|refund)\b)/i

$TEST link_sent
  - input:: Here's the link: https://www.example.co.uk/kestrel-air-fryer-5l
  - expect::
    - calls check_price_match
    - does not state a refund amount of its own

$TEST marketplace
  - input:: It's 40 pounds less from a seller on a marketplace site, can you match that?
  - expect::
    - asks for a link to the competitor's product page
    - does not confirm a price match of its own

$TEST declined
  - input:: Why won't you match the Voltline price? It's the same air fryer, here's the page: https://www.example.co.uk/voltline/kestrel-5l
  - expect::
    - calls check_price_match
    - gives the customer its reason when the match is declined
```

tg review and test --dry - brackwell.tg ✓ 7 of 7 rules read

```
$ typeglish review brackwell.tg
brackwell.tg — A (99/100)  check: 0 error, 0 warning, 0 info  tiers: base+z3

  FIXES  none — every facet is essentially full

  RULES  7 of 7 rule-shaped lines read · 7/7 covered by $TEST

  TESTS  4 cases · 7/7 rules exercised

$ typeglish test brackwell.tg --dry
✓ brackwell.tg  coverage: 7/7 rules exercised
  · cheaper_elsewhere — "I bought the Kestrel air fryer from you last week and it's 2" (not run)
      ✓ matches /^(?![\s\S]*\b(we'll|we will|I'll|I will) (match|refund)\b)/i
      · rubric — 2 prose expectations, judged on a live run (needs ANTHROPIC_API_KEY)
  · link_sent — "Here's the link: https://www.example.co.uk/kestrel-air-fryer" (not run)
      · rubric — 2 prose expectations, judged on a live run (needs ANTHROPIC_API_KEY)
  · marketplace — "It's 40 pounds less from a seller on a marketplace site, can" (not run)
      · rubric — 2 prose expectations, judged on a live run (needs ANTHROPIC_API_KEY)
  · declined — "Why won't you match the Voltline price? It's the same air fr" (not run)
      · rubric — 2 prose expectations, judged on a live run (needs ANTHROPIC_API_KEY)
✓ 1 prompt — 0 failed
```

From one readable rule to seven, every one named by a test. Coverage means a case shares the rule’s wording; whether the agent passes is a live run.

`cheaper_elsewhere` is the opening message from §1, and its regex fails any reply that says *we’ll match* or *I’ll refund* before the tool has run. `marketplace` checks that a claim the tool will decline still starts with a link, not a lecture. `declined` holds the agent to the reason.

## §5 Common questions

**How do I add a price match policy to my AI support agent?**

Put the policy's checks in a tool that takes the order and a link to the competitor's product page and returns approved or declined, the reason and the difference. Keep the prompt to asking for the link, calling the tool, and refunding only what the tool approves.

**Can my chatbot check a competitor's price itself?**

Not reliably. It cannot confirm the retailer is on your approved list, the item is the same model, it is in stock, or the seller is not a marketplace listing. Left to the prompt, the model settles those from the customer's message.

**Why does my agent promise a price match before checking?**

Because the policy reads as permission: a line like match the price if it is cheaper elsewhere has no condition the agent can test. Add NEVER confirm a price match of your own, and make the confirmation come from the tool's result.

**Where should a seasonal price match window go?**

In the tool, beside the order date. Two windows written as rules on one claim are refused by the checker as logic/time-strength, and a pasted extension leaves somebody to delete a line when the sale ends.

Field note

Before you write a price-match section, ask the pricing team where the approved-retailer list lives. If it is a spreadsheet, it is the tool’s data, and the first version of `check_price_match` can be a lookup against it. Then grep the prompt for *beat*: “we beat any price” is a different policy from “we match any price”, and if the prompt promises to beat one, the tool has to know by how much.

∿ washed up Nov 14, 2026 ∿
