AWS Builder Center
I built something that already exists, and shipped it anyway

I built something that already exists, and shipped it anyway

Finding your own product on Google? Running into an AWS service that wants three separate security policies before it'll answer a single query? Both happened in the same weekend, and neither one was the reason to stop.

What happens when a single digit on a spreadsheet causes a loss of 2 CRORES?



A company imports "Active Noise Cancelling Headphones with a Lithium-Ion Battery."
Get one digit wrong in the 8-digit tariff code, and customs doesn't send a polite email, it seizes the shipment, or slaps on a 100%+ anti-dumping penalty.
In one real case we dug up, a single classification dispute produced a ₹2 crore duty demand on a transaction whose entire margin was smaller than that. In another, an ₹11 crore notice got issued before a court eventually threw it out. Multiply that by the roughly 1.4 crore GST-registered businesses in India who have to get this right on every invoice, and you've got a problem that's boring to describe and expensive to get wrong, our favorite kind of hackathon target.
So we built HSN-Sentinel: you describe a product, it retrieves real customs precedent, and it gives you a classification with a legal citation attached instead of a confident guess.

Then I found my own product on Google.

About an hour into architecture planning, a search for "AI HSN classification" turned up three live products doing almost exactly this, one of them literally an India-specific tool running vector search over 44,855 CBIC circulars and CESTAT judgments, built on Claude. That's a strange thing to find mid-build. It's also, weirdly, the best possible validation: three separate teams had already decided this problem was worth solving commercially. We stopped trying to pitch "nobody's doing this" and started pitching the thing that was actually true, a scoped, cited, honest version of a real problem, not a science project.

The stack, and why it kept shrinking

We started with the ambitious version: Step Functions orchestrating an async Textract job, OpenSearch Serverless as a vector engine, AppSync pushing results over GraphQL subscriptions. On paper it looked like a great "architecture" slide. In practice, OpenSearch Serverless alone needs three separate policies, encryption, network, data access, before it accepts a single query, and the collection takes real minutes to spin up. That's not a weekend risk, that's a whole-Saturday risk for a dataset of about 30 documents that doesn't need a production vector database in the first place.
What actually shipped is deliberately boring: Amplify Hosting for the frontend, one API Gateway route, and a single Lambda that runs a linear pipeline, hash the input, check the cache, embed it, rank against our precedent set, classify with Bedrock, write the result back to cache. No orchestration framework. No branching logic. One function, six steps, in order, every time.


What fought back

The DynamoDB cache had a bug baked into the "clever" part of the design: we'd set the table up with a partition key and a sort key, which meant looking up a cached result required knowing the timestamp of the very thing we were trying to look up. Fixed it by dropping to a single partition key, the whole point of a hash-based cache is a direct lookup, not a range query.
Then there was the demo trick we actually cared about: upload the same input twice, and the second time should cost basically nothing, because it hits cache. Except in the first draft, the cache check ran after the OCR step, so the "free" second run was still paying for the expensive part every time. Moved the hash check to the very front of the pipeline, before anything touches Textract or Bedrock.
Bedrock had its own trap waiting: pass the bare model ID for a current-generation Claude model and it fails with an on-demand-throughput error, you need the cross-region inference profile ID instead, with a region prefix. Not documented anywhere obvious, discovered exactly the way you'd expect: by hitting it.


The AgentCore question we asked ourselves on purpose

Partway through, we stopped and asked whether any of this should be running on Bedrock AgentCore instead of a hand-written Lambda. It's tempting, a managed runtime, built-in memory, tool execution handled for you. We talked ourselves out of it, and the reasoning is worth stating plainly rather than hiding: our pipeline has no branching. There's no point where a model needs to decide which tool to call next, no multi-turn back-and-forth, nothing agentic about it, it's

hash, cache, embed, rank, classify, write

in that exact order, every single time. AgentCore is built for the case where the next step isn't known in advance. Ours always is.
There's a second reason, and it matters more given what this tool is for: the confidence score in our output isn't a number an LLM invented, it's the literal cosine similarity between the query and the closest matching ruling in our dataset. That's deterministic and auditable. Handing retrieval over to a managed agent loop would trade that away for a black box, in a domain where "trust me" is exactly the thing that gets you an ₹11 crore show-cause notice.
So: one Lambda, for now. The natural point to revisit AgentCore is the moment this stops being a single deterministic lookup, if it grows into something that autonomously pulls live tariff schedules from external APIs, cross-references WTO databases, chains multiple reasoning passes before answering, or needs to remember context across a multi-turn conversation with a compliance officer. At that point the problem actually becomes agentic, and AgentCore stops being over-engineering and starts being the right tool. We're building v1 to make that v2 possible, not pretending we need it today.

What it is, honestly

Not a replacement for a customs broker. A compliance co-pilot that shows its work: every classification comes with the specific ruling it leaned on, or an honest "no direct precedent found" instead of a confident-sounding fabrication. Given what's at stake in this domain, that felt like the only version worth shipping.
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