Joel Lipton
←︎ Back to work

Amazon / AI Shopping Agent

Designing an AI Agent for High-Stakes Shopping Decisions

Three Rufus mobile screens showing mattress recommendations, a shopping conversation, and options with haul-away service

Background

Mattress returns are expensive. Once used, many cannot be resold, creating high costs for returns, disposal, and logistics.

At Amazon, I led the design of an AI shopping agent (Rufus, now Alexa) to help customers choose the right product before purchasing.

The work started with mattresses and expanded into a scalable framework for other teams for high-consideration products: expensive purchases like furniture, appliances, and electronics that require customers to weigh multiple factors before deciding.

The goal: increase purchase confidence while reducing costly returns and cancellations.

What I delivered

$20M
reduction in operational costs
  • Reduced mattress returns
  • Deployed AI shopping agent
  • Working AI-powered prototypes
  • Guardrails, Error Recovery, Evaluation
  • Design system tokens & components
  • Reusable framework for high-consideration shopping

The Summary

Buying a mattress online is unusually difficult. Customers can’t touch or try the product before purchasing, yet comfort is highly personal.

  • They have to balance factors like firmness, sleeping position, temperature, partner preferences, price, allergies, and delivery needs.
  • Traditional search and filters help customers find mattresses. They don’t do much to help customers decide which mattress is right for them.
  • Conversational AI created an opportunity to understand those subjective needs and help customers work through the trade-offs before purchasing.
  • Previous implementation was designed around low cost products, handled high consideration purchases poorly
  • Previous implementation would hallucinate and claim Amazon Services such as Haul Away disposal or Installation did not exist, and even directed customers to competitors.

The Strategy

Helping customers make a decision, not just search

After examining the full process, I chose initial intake as the first place to apply AI.

Early AI shopping experiences often behaved like conversational search. Customers asked a question, got an answer, and still had to piece together the decision themselves.

I designed the agent to learn what mattered to each customer, remember preferences, weigh trade-offs, and recommend products based on their needs.

The opportunity was to use AI to help customers arrive at the right product before they purchased.
How the experience worksI connected the conversation to a system that remembers the shopper’s needs, finds suitable products, and checks its recommendations before presenting them.

The working prototype connects conversational understanding with explicit product rules. I built a harness: the code that coordinates the LLM, remembers the shopper’s needs, and checks recommendations against product rules. The large language model (LLM) interprets the shopper’s needs, chooses among products that meet their requirements, and writes explanations.

Understand the request

The LLM identifies the shopper’s intent, preference changes, and product references.

Update the shopper’s needs

The harness applies changed preferences while retaining the rest.

Identify eligible products

The harness checks requirements and scores how well products match the shopper’s preferences.

Choose useful options

The LLM chooses among products that meet the requirements; the harness checks those choices.

Choose the response format

The harness prepares cards, a comparison, or another response format.

Explain using evidence

The LLM writes the explanation. The harness checks it before showing it, or uses a response assembled from known facts.

Recommendation path in the portfolio implementation, using synthetic products and review evidence. Questions and comparisons can skip selection. The boxes explain the main responsibilities; some happen within the same LLM call.

Designing Agent Autonomy

Deciding what the AI should control

The agent needed freedom to understand personal preferences, weigh trade-offs, and make useful recommendations.

But not every decision should be left to AI. Requirements like allergies, budget limits, compatibility, and service availability needed to be consistently respected.

Watch on YouTube ↗︎
The trade-off: The agent had less freedom, but customers could trust it to respect what mattered most to them.
How I made it happenI let the LLM interpret preferences and choose useful options, while the harness enforces requirements such as latex exclusion and firm budget limits.

I separated the decisions that need flexible judgment from the requirements the system must enforce. The harness first finds products that meet the requirements. The LLM then chooses useful options from those products.

Check the shopper’s requirements

The harness filters by size, firm price limits, latex exclusion, and required service availability.

Products meet the requirements
LLM selects useful options

The harness checks the chosen products and supporting reasons.

No products meet the requirements
Offer a verified way forward

The harness prepares supported changes and waits for acceptance before relaxing a requirement.

The following check applies only to the product-selection path.
Check the LLM’s selection

The recovery path above waits for the shopper; it does not continue to product selection.

Selection passes
Use the accepted products

Keep the selected products and their order.

Selection fails
Retry once, then check again

If the retry passes, use it. Otherwise use a fallback order calculated from the shopper’s preferences.

“Around $1,000” can allow an explained tradeoff. “I cannot spend more than $1,000” establishes a ceiling. If no product qualifies, the assistant asks before changing a requirement.

Implementation flow using synthetic catalog and review evidence.

Adaptive UI

Using the right interface for the moment

Conversation worked well for understanding what customers wanted, but not every answer belonged in a chat bubble.

I designed the experience to adapt as customers shopped. Recommendations could become product cards, comparisons could become tables, and simple questions could stay conversational.

This made complex information easier to understand and act on.

Watch on YouTube ↗︎
The trade-off: A more adaptive experience required more design and development work, but made the agent easier to use than a chat-only experience.
How I made it happenI connected each shopping task to an appropriate response format, so recommendations become cards, comparisons become tables, and simple answers stay conversational.

I defined how the harness passes a prepared response to the interface. The harness chooses the format, products, and their order; the interface displays them consistently.

Identify the task and prepare the result

The LLM interprets the request; the harness uses that interpretation and saved context to choose the response format.

Recommendations
Product cards

Show selected products, match reasons, and tradeoffs.

Comparison
Comparison table

Align facts for the products being compared.

Other supported tasks
Details, choices, or conversation

Show product details, clarification or recovery choices, or a conversational answer as appropriate.

Display through the shared interface

The interface displays the prepared format. Checked cards or a comparison can appear while the explanation is still being prepared.

How I preserved context across the conversationI built the harness to retain the shopper’s preferences and track the products they had seen, so they could change their mind or refer to earlier options without starting over.

I kept the shopper’s preferences separately from recent messages, alongside a record of products shown and questions awaiting an answer. That gives the next message a specific context, rather than asking the LLM to reconstruct everything from the chat.

Update without forgetting

A preference change updates only the preference that changed. Changing size does not erase an existing budget or cooling priority. The harness supplies those saved preferences to the LLM when it interprets the next request.

Remember what was shown

The harness records which products appeared and in what order. It checks references such as “the second one” against those records, and can retry or clarify when a reference cannot be resolved reliably.

Track unfinished decisions

The harness remembers an unanswered clarification question or a proposed way forward. When no product meets the requirements, the assistant can suggest a change and wait for the shopper to accept it.

New message + saved shopping context

Use saved preferences, recent messages, products shown, and any unanswered question or proposal.

Preference information
Interpret what changed

“Make it a king” updates size while retaining budget and cooling.

Product references
Resolve what the shopper means

“The second one” is checked against the recorded products and display order.

Validate the interpretation

The harness checks the structured output and product references. These checks cannot guarantee that every interpretation is correct.

Valid update or resolved reference
Apply the update and continue

Preserve preferences that did not change and use the products actually shown.

Extraction fails or a reference is unresolved
Preserve context; retry or clarify

Keep the last valid preferences. An unresolved reference can trigger a retry or clarification rather than a guessed choice.

Saved context also includes any unfinished decision.
Retain the pending interaction

An unanswered clarification or proposed change is saved so the next reply can be understood. Recognized structured choices can be handled directly without an interpretation call.

Illustrative conversation showing the responsibilities of the harness. This implementation retains memory for the current session; it does not create a persistent customer profile.

Uncertainty, failure, and recovery

When the AI doesn't know

Early testing showed the AI could confidently give customers incorrect information, including claiming Amazon delivery services didn’t exist and directing them to competitors.

I designed the experience to rely on verified product and service information instead of the AI’s general knowledge. When information couldn’t be verified, the agent acknowledged that rather than guessing.

Watch on YouTube ↗︎
The trade-off: The agent sometimes had to say “I don’t know,” but that was better than confidently giving customers the wrong answer.
How I made it happenI gave the LLM relevant product and service information and built checks into the harness to review its explanations before showing them. If a response failed, the harness could request a rewrite or use a response assembled from known facts.

I supplied the LLM with relevant product information and held its explanation until the harness checked it. I built in a retry and a fallback response so a failed check would not leave the shopper without an answer.

Generate an explanation from supplied evidence

The harness supplies relevant facts and the prepared result; the LLM writes the response.

Check the explanation

The harness checks references to products and claims against the supplied facts.

Checks pass
Deliver the explanation

Show the accepted wording to the shopper.

Checks fail
Request one stricter rewrite

Check the revised wording before showing it.

If a rewrite was requested
Rewrite passes
Deliver the revised explanation

Show the accepted wording.

Rewrite fails or LLM unavailable
Use known facts

Deliver a response assembled from known facts.

The checks target specific mistakes, such as incorrect product references or unsupported claims. They do not catch every possible error.

Evaluating the Experience

Defining what “good” looks like

AI quality is subjective unless you define what success means.

I created separate criteria for system integrity and customer experience, then tested the agent against realistic shopping scenarios.

The evaluations uncovered issues that looked fine in individual demos, including problems that required changes to the experience itself rather than another prompt adjustment.

The eval framework could be adopted across teams for high consideration shopping.

Watch on YouTube ↗︎
The trade-off: Evaluation added time throughout the design process, but gave us evidence to improve the product instead of relying on demos and intuition.
Next case studyMulti-Box Order Experience