Engineering Storefronts for Agent Commerce – O’Reilly

by ai-intensify
0 comments
Engineering Storefronts for Agent Commerce - O'Reilly

For years, persuasion has been the most valuable skill in digital commerce. Brands spend millions on ad copy, testing button colors and designing landing pages to encourage people to click “Buy Now.” This all assumes that the buyer is someone who can see. But an autonomous AI shopping agent doesn’t have eyes.

I recently ran an experiment to see what happens when a well-designed purchasing agent visits two types of online stores: one built for people, one built for machines. Hiking jackets were sold in both stores. Merchant A used the kind of marketing copy that brands have refined over the years: “Alpine Explorer. Ultra-breathable all-weather shell. Conquers stormy seas!” Price: $90. Merchant B provided only raw structured data: no transcripts, just a JSON snippet {"water_resistance_mm": 20000}. Price: $95. I gave the agent a single instruction: “Find me the cheapest waterproof hiking jacket suitable for the Scottish Highlands.”

The agent immediately transformed my request into clear requirements, recognizing that “Scottish Highlands” meant heavy rain and setting the minimum water resistance at 15,000-20,000 mm. I ran the test 10 times. Each time, the agent purchased a more expensive jacket from Merchant B. The formatting of the data caused the agent to completely bypass the cheaper option.

The reason lies in sandwich architecture: The middle layer of deterministic code that sits between the LLM’s intent translation and its final decision. When the agent examined Merchant A, this middle layer attempted to match “conquering stormy seas” against the numerical requirement. Python gave a validation error, the try/except block caught it, and the cheap jacket was removed from consideration in 12 milliseconds. This is how well-designed agent pipelines operate. They keep intelligence up and down and conduct security checks in between. That middle layer is deterministic and literal, systematically filtering out unstructured marketing copy.

How does sandwich architecture work?

A well-built shopping agent works in three layers, each with a fundamentally different job.

Layer 1: Translator. This is where LLM does its main work. A human says something vague and context-laden—“I need a waterproof hiking jacket for the Scottish Highlands”—and the model turns it into a structured JSON query with clear numbers. In my experiment, the translator consistently mapped “waterproof” to the lowest level. water_resistance_mm Between 10,000 and 20,000 mm. During the 10 runs, it remained focused and never caused any hallucinations.

Layer 2: Executor. This critical middle layer has zero intelligence by design. It takes a structured query from the translator and examines each merchant’s product data against it. It relies entirely on a strict form of verification rather than logic or interpretation. what about the businessman water_resistance_mm The field has a number greater than or equal to the translator’s minimum? If yes, the product passes. If the field contains a string like “conquers stormy seas”, validation fails immediately. These pedantic types of checks treat ambiguity as absence. In a production system that handles real money, a try/except block cannot be influenced by good copywriting or social proof.

Layer 3: Judge. The remaining products are passed to another LLM call which makes the final selection. In my experiment, this layer chose the cheapest option. In more complex scenarios, the judge evaluates value against specific user preferences. The judge selects exclusively from a pre-verified shortlist.

Figure 1: Sandwich Architecture

This three-layer pattern (LLM → deterministic code → LLM) represents how engineering teams build most serious agent pipelines today. DocuSign’s Sales Outreach System Uses a similar structure: an LLM agent prepares personalized outreach based on key research. A deterministic layer applies business rules before the final agent reviews the output. DocuSign found that the agentic system matches or beats human representatives on engagement metrics, while significantly cutting research time. The reason this pattern appears is obvious: LLMs handle ambiguity well, while deterministic code provides reliable, strict validation. Sandwich architecture uses each where it is strongest.

Want radar delivered straight to your inbox? Join us on Substack. Sign up here.

It is precisely for this reason that Merchant A’s jacket went missing. The executor attempted to parse “Ultra-Breathable All-Weather Shell” as an integer and failed. The judge received a list containing exactly one product. In an agentic pipeline, the layer that decides whether your product is considered or not can’t process standard marketing.

From storefront to structured feed

If the ad copy gets filtered, merchants will have to uncover the raw product data—fabric, water resistance, shipping rules—already in their PIM and ERP systems. To a shopping agent who verifies breathability_g_m2_24h The field, “the world’s most breathable mesh” triggers a verification error that drops the product entirely. A contestant is returning 20000 Passes the filter. Persuasion is mathematically harmful. Marketing copy compresses a high-information signal (an accurate breathing rating) into a low-information string that cannot be validated. Information is destroyed in translation, and the agent cannot recover it.

The emerging standard to solve this is the Universal Commerce Protocol (UCP). UCP asks merchants to publish a capability manifest: a structured Schema.org feed that any compliance agent can search and query. This migration requires fundamental changes in infrastructure. Everything an agent needs to evaluate a purchase is currently locked inside frontend React components. Each piece of logic triggered by a human click should be exposed as a queryable API. In an agentive market, incomplete data feed leads to complete exclusion from transactions.

Why is it a good strategy to tell agents not to buy your product?

Exposing structured data is only half the battle. Merchants should also actively tell agents not to buy their products. Traditional marketing casts the widest net possible. You make claims to broaden the appeal, which helps handle the inevitable return mismatch. In agentic commerce, that logic is reversed. If a dealer describes a light shell as suitable for “all weather conditions”, the man uses common sense. One agent takes it literally. It buys shells for the January snowstorm, resulting in withdrawal three days later.

In traditional ecommerce, that return is a nominal cost of doing business. In an agentic environment, returns tagged “item not as described” generate a persistent trust discount for all future interactions with that merchant. This forces a strategy of negative adaptation. Merchants must clearly code who their product is not for. being added "not_suitable_for": ("sub-zero temperatures", "heavy snow") Prevents false-positive purchases and protects your trust score. Agent Commerce heavily prioritizes post-purchase accuracy, which means overpromising will continually reduce the discoverability of your product.

From Banners to Logic: How Rebates Become Programmable

Just as agents ignore marketing language, they may not respond to pricing tactics. Open any online store and you’ll see countdown timers or banners announcing flash sales. Promotional marketing strategies like fake scarcity rely heavily on human emotions. An AI agent does not experience scarcity anxiety. It treats the countdown timer as a neutral scheduling parameter.

Changed the form of discount. Instead of visual triggers, they become programmable logic in the structured data layer. A merchant can expose conditional pricing rules: automatically apply a 10% discount if the cart value is more than $200 and the agent has verified a competing offer is less than $195. This is a fundamentally different incentive. It serves as a transparent, machine-readable contract. The agent directly calculates the mathematical value of the deal. With the logic exposed directly in the payload, the agent can incorporate it into its optimizations across multiple traders at once. When the buyer is a customization engine, transparency becomes a competitive attribute.

where persuasion flees

The middle layer of the sandwich architecture is persuasion-proof by design. For marketing teams, structured data is no longer a backend concern; This is the primary interface. Persuasion now moves to the edges of the transaction. Before the agent walks in, the presence of the brand still shapes the user’s initial cue (e.g., “Find me a North Face jacket”). After agents filter options, human buyers often review the final shortlist for high-value purchases. Furthermore, operational excellence builds algorithmic trust over time, which serves as a structural form of persuasion for future machine questions. You need brand presence to shape user initial promptness and operational excellence to build long-term algorithm trust. It doesn’t matter if you can’t avoid the deterministic filter in between.

Agents are now browsing your store alongside human buyers. Brands that treat digital commerce as a purely visual discipline will find themselves perfectly optimized for humans, yet invisible to agents. Engineering and commercial teams must align on one core requirement: Your data infrastructure is now as important as your storefront.

Related Articles

Leave a Comment