AWS Builder Center

PayGuard: an agent that investigates scam texts instead of just scoring them

["aws", "hackathon", "strands-agents", "dynamodb", "bedrock", "fraud-detection"]

Every UPI user in India gets some version of this text at least once a month: "Your account has been credited with Rs. 8850, register for free, [some shortened link]." It looks harmless enough that people click it. We built PayGuard to stop that click, and to explain why the link is dangerous instead of just slapping a risk score on it and hoping the user trusts us.

What it does

You paste a suspicious SMS, WhatsApp message, or a screenshot of one. An agent then goes and investigates it the way a fraud analyst would: it pulls out any link and checks the registered domain for lookalikes and typosquats against a knowledge base of real Indian banks and payment apps, decodes UPI QR payloads to catch payee or amount mismatches, and scans the text against a lexicon built for the local scam playbook, fake KYC, fake refunds, OTP and PIN harvesting, job-fee scams.
All of that evidence lands in a ledger. A deterministic, YAML-defined risk engine scores it into LOW_CONCERN, CAUTION, or HIGH_RISK. No LLM sits in that scoring path, so the same evidence always produces the same score. An LLM writes the final explanation, but every claim it makes gets checked against the ledger and rejected if it isn't backed by something the tools actually found.

Where AWS fits

The agent loop runs on Strands Agents SDK, AWS's open-source framework. It didn't play nicely with our primary dev endpoint (NVIDIA NIM) on multi-turn tool calls, so we also wrote a hand-rolled fallback loop against the raw chat completions API and kept Strands wired in as a selectable runtime instead of ripping it out.
Persistence is a single-table DynamoDB design over boto3: case metadata, evidence, and the full tool-execution trace, with TTL so nothing outlives its usefulness. We built and tested the entire data model against DynamoDB Local before it ever touched a real AWS account.
The LLM provider layer is deliberately provider-agnostic, built to run on Bedrock's OpenAI-compatible endpoint with a three-environment-variable swap and zero code change from our NVIDIA NIM dev setup. NIM's free tier reserves the right to retain prompts and outputs, which is disqualifying the moment you're reading someone's bank SMS.

The bug that almost shipped

Late in the hackathon, we tested the exact message at the top of this post. It came back LOW_CONCERN, score zero. Completely wrong.
Turned out the link in that message,  zx6.in/nFa/8scZU3v , had no  http://  in front of it, which is exactly how real smishing links look. Our URL-detection regex required a scheme, so the link was invisible everywhere: to ingestion, to the coverage check that forces a domain inspection, to everything downstream of it.
Fixing that opened up three more bugs stacked underneath it. The coverage checker that's supposed to guarantee a minimum level of investigation only ever forced one tool call total, not one per gap. Our pattern-matcher added zero evidence when it found nothing, which meant the checker kept re-triggering the same no-op call until it burned through the whole tool budget. And the risk engine scored by signal name only, so a "found nothing suspicious" result was silently picking up the positive weight meant for "found something suspicious," because both used the same signal.
We fixed all four, then reran the full evaluation harness against the tuned 90-case test set to make sure we hadn't broken anything: 97.78% accuracy, 0% false positive rate, identical to before. The message that started this now correctly comes back CAUTION, with the actual evidence attached.

Why this matters more than the demo

None of those four bugs would show up in a clean demo run. They only show up when someone throws a genuinely adversarial, real-world message at the system, which is the whole point of building something meant to catch fraud. We'd rather find that out during a hackathon than after someone trusted a wrong verdict.
Two of us built this in a few days. It's not finished. But the evidence-first design held up exactly when it needed to: when the score was wrong, the ledger showed us which signal, which regex, which line to look at.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article