Skip to content
theLeverager1705Public

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

9 Commits

Folders and files

Repository files navigation

AGNI

Making small Indian shops visible to AI shopping agents.

Razorpay AI Buildathon 2026 — Track: AI Growth & Agentic Commerce


The thing I couldn't stop thinking about

In January 2026 Google shipped the Universal Commerce Protocol. OpenAI and Stripe have the Agentic Commerce Protocol running live on Etsy and a million-plus Shopify stores. The short version: an AI agent can now search a catalog, pick a product, and pay for it, without a human ever opening a website.

Here's what got me. Agents don't rank merchants the way Google did. There's no backlinks, no domain authority, no ad budget to outspend anyone with. An agent picks based on whether your product data is structured, current, and complete enough for it to be confident it won't screw up someone's purchase. Which means a tiny shop with clean data can genuinely beat a huge brand with a messy catalog.

That should be the best news Indian small merchants have had in a decade.

Except roughly 60 million of them sell through a WhatsApp broadcast list. Their catalog is a text message. It reads like Cotton kurta 899 S M L XL. There's no price field, no stock signal, no return policy, no SKU, nothing an agent can parse. To an AI buyer, these shops don't exist. Not ranked low — absent.

So the opportunity is real and it's pointed directly at exactly the people who can't reach it. That gap is what AGNI is for.

What I built

You paste in a merchant's actual WhatsApp price list. AGNI turns it into something an AI agent can find, evaluate, and buy from — then tells the merchant, in plain language, why agents were skipping them before.

Running it on the sample catalog in this repo (sample_data/whatsapp_catalog.txt, 10 messy lines of real-looking WhatsApp text):

  • pulled out 23 structured SKUs, including splitting S M L XL into separate buyable variants
  • Agent-Readiness score went 25 → 100
  • simulated AI buyer win rate went 0% → 75%
  • an AI buyer agent then completed an actual purchase end to end through Razorpay test-mode, settled by a signature-verified webhook

Those numbers are from the no-API-key path, so you can reproduce them exactly.

Try it

pip install -r requirements.txt
python -m uvicorn app.main:app --reload

Then in a second terminal:

python scripts/demo.py

That's it. No keys needed. The demo walks the whole story: onboard a messy shop, score it, watch AI buyers reject it, generate the lessons that explain why, fix what a machine can fix, let the merchant fill in the rest, re-run the buyers, and close with a real agent purchase.

Prefer to click through it yourself? Open http://localhost:8000/ and drive the same story in the browser — paste a catalog, watch the score climb, and let an AI agent buy something. API docs are at /docs.

If you want the real thing, copy .env.example to .env and drop in Razorpay test-mode keys and an Anthropic key. Everything works either way — more on that below, because it's a deliberate design choice, not a shortcut.

How it works

WhatsApp text dump
      │
      ▼
  ingest.py ──── parse into structured SKUs
      │
      ▼
 readiness.py ── score it, 11 factors, every failure gets a reason code
      │
      ├──────── autofix ─── close everything a machine can close
      │
      ▼
 simulator.py ── run synthetic AI buyers at it, log every win and loss
      │                              │
      ▼                              ▼
 agent_api.py                   academy.py
 (what an agent talks to)       (turn each loss into a 90-second lesson)
      │
      ▼
 razorpay_client.py
 (Orders + Payment Links, HMAC-verified webhook)

The scoring rubric is the actual IP here (app/readiness.py). It's 11 factors across four dimensions — catalog structure, machine-readability, fulfilment certainty, and trust. Each one carries a weight, a plain-English explanation of why agents care, and a flag for whether software can fix it or the human has to.

The part I'm proudest of: those reason codes are one shared vocabulary across the whole system. The scorer emits NO_RETURN_POLICY. The buyer simulator emits the same code when it walks away from a purchase. The academy consumes that code to write the lesson. So a lesson can only ever be generated from something that actually just happened to that specific merchant, and it's addressed to whoever can fix it. Nothing generic, nothing stale.

That's also why this is one product and not two bolted together. Everyone in this space is building either catalog tooling or merchant education. The insight is that the diagnosis and the curriculum are the same data.

Decisions I'd defend in the interview

Every AI call has a deterministic fallback. app/llm.py takes a fallback function at every call site. No API key, bad JSON, network hiccup — it drops to regex and rules and tags the response source: "fallback" so the degradation is visible instead of silent. I did this because a demo that dies on stage is worth zero, but I kept it because it's honestly how you'd ship this to merchants on flaky connections.

AGNI refuses to invent policy. It will happily write your product descriptions and attributes. It will not make up your return window, your delivery time, or your legal name, even though inventing them would make the score look better in a demo. Those gaps stay open until the merchant fills them in. Making up a return policy on a real merchant's behalf is how you get a merchant sued.

Human review before anything reaches a merchant. Generated lessons land in pending_review. Someone approves before publish. At payments-platform scale you do not push unreviewed generated content to merchants.

The agent API is protocol-shaped, not protocol-locked. Five calls: manifest, search, item, checkout, order status. UCP and ACP both want roughly this shape, so supporting either is a translation layer over these, not a rewrite. I'd rather be adaptable than bet the build on one standard winning.

What broke while building this

Being honest here because I think how you debug matters more than whether the first draft worked.

The database rejected every write. table merchants has no column named doc — I had a generic insert helper writing a JSON blob to a doc column, and I'd forgotten that column on one table. Fast fix, but it took a stack trace to find because the helper was doing the right thing everywhere else.

My parser invented a product out of a shop's header. The line *Anjali Handlooms - New Arrivals* became a SKU, because my first regex accepted any line with a 2+ digit number as a priced item. That fake product had no price, which tripped the MISSING_PRICE gate, which tanked the score for a reason that had nothing to do with the merchant. Fixed by requiring an actual price match or an explicit "DM for price" marker before a line counts as a product.

Sizes with spaces didn't split. S, M, L worked. S M L XL didn't — my size regex only handled comma and slash delimiters. So a four-variant listing survived as one ambiguous SKU, which is the single thing agents choke on hardest. Rewrote it to match a run of size tokens regardless of what's between them. This one mattered a lot: it's what took the sample catalog from 13 SKUs to 23.

My before/after numbers were quietly wrong. The visibility report pulled the last 60 queries with no batch boundary, so a "before fix" run and an "after fix" run got blended together instead of compared. Every improvement looked smaller than it was. I added a batch id per simulation run — and had to sort by rowid rather than created_at, because SQLite's CURRENT_TIMESTAMP only has second resolution and two runs a moment apart tie, putting the batch boundary in the wrong place.

pydantic wouldn't install. Pinned exact versions in requirements.txt, and on Python 3.14 there was no prebuilt wheel for that pin, so pip tried to build it from Rust source and died on a TLS error. Switched exact pins to lower bounds so pip resolves to a wheel that already exists.

What's not done

Being straight about this rather than overselling:

  • No real UCP or ACP adapter yet — the shape is there, the translation layer isn't
  • The buyer simulator's intent bank is hand-written per category, not learned from real agent traffic
  • The dashboard's payment leg uses /agent/settle-demo, which signs and verifies a real payment.captured payload but skips the hosted payment page a browser can't drive unattended. It runs through the same signature check and the same settlement function as the live webhook — one implementation, not a demo shortcut
  • Multi-language lessons are wired for it but only tested in English
  • No auth on the merchant API — fine for a prototype, obviously not for production

Where I'd take it

Short term, the readiness score and the buyer simulation are free — that's the hook, because no merchant currently has any way to see that AI buyers are passing them over. Autofix and agent checkout are the paid upgrade, and every agent-completed sale is a transaction that wouldn't have existed otherwise.

The bigger idea is the ops half. The same rejection data, aggregated across a whole merchant portfolio, is a live training feed for a payments company's own support, risk, and onboarding staff — what's actually breaking this week, not a slide deck from last year. That's the part that scales past one merchant.

Long term, I want the Agent-Readiness score to be the answer to "am I visible to AI buyers?" the way an SEO score answered that question for search. And this problem isn't only Indian — every market that went mobile-commerce-first through chat apps is about to hit the same wall.

Repo layout

app/
  main.py              FastAPI app, merchant API, webhook handler
  agent_api.py         what an AI buyer talks to: manifest, search, checkout, status
  ingest.py            raw WhatsApp text → structured SKUs
  readiness.py         the scoring rubric — the core IP
  simulator.py         synthetic AI buyers, win/loss with reason codes
  academy.py           reason code → 90-second lesson, for merchants and for ops
  razorpay_client.py   Orders, Payment Links, HMAC webhook verification
  llm.py               Claude wrapper, deterministic fallback at every call site
  db.py, config.py     SQLite storage, environment config
scripts/demo.py        the full end-to-end walkthrough
sample_data/           a genuinely messy WhatsApp catalog

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages