Skip to content

Real-Time Customer Retention Agent

Keep hesitating shoppers by responding in the same session, not in a batch email after they leave.

A next-best-action agent that responds to shopper hesitation while the session is still live.

What the agent does

Reads live hesitation signals and writes a next best action, such as a recommendation or shipping offer, for the storefront to show.

Built by
MongoDB Industry Solutions
Contributed by
MongoDB (Built the reference implementation and the streaming data layer)
Industry
Retail
Audience
B2C
01
The problem

Why this exists

Most retailers keep shopper behavior in systems of record and analyze it later. By the time an abandoned-cart email goes out, a retargeting campaign starts, or someone reads a dashboard, the shopper has already left.

Read more

Keeping a customer costs far less than winning a new one, but only if the retailer can act while the session is still active, and without replacing the storefront it already runs.

02
Outcomes

What this demonstrates

  • Raw clickstream becomes one live session-state document per session, refreshed about every 10 seconds, with a weighted intent model.
  • Three explainable signals (high intent, exit risk, and search friction), each with a severity and a plain-language evidence note.
  • An agent turns each signal into a next best action: a tailored recommendation, a social-proof message, or a shipping offer.
Read more
  • No separate streaming platform to run; Kafka, Pub/Sub, Event Hubs, or Kinesis can feed it instead.
03
How it works

Architecture

A sample storefront, Leafy Pop-Up Store, writes its events to a collection and otherwise stays as it is. Atlas Stream Processing builds a session-state document from 10-second windows, and three more processors read those snapshots over 30-second windows to detect high intent, search friction, and exit risk.

Read more

A change stream on the signals collection triggers the decision agent. It reads live session state together with the shopper's profile, the catalog, promotions, and business rules from the same database, using MCP, Atlas Vector Search, Voyage AI embeddings, and an LLM on Amazon Bedrock, and writes a next best action.

The storefront watches that collection through its own change stream and shows the action to the active shopper as a product highlight, a cart message, or a pop-up.

The Leafy Pop-Up Store sample storefront writes events to a collection. Atlas Stream Processing builds a session-state document over 10-second windows, and three processors read it over 30-second windows to detect high intent, search friction, and exit risk, writing to a signals collection. A change stream on that collection triggers the decision agent, which uses MCP, Atlas Vector Search, Voyage AI embeddings, and an LLM on Amazon Bedrock, and reads the shopper profile, catalog, promotions, and business rules from the same database. It writes a next best action, which the storefront picks up through its own change stream and shows to the active shopper as a product highlight, a cart message, or a pop-up.

The Leafy Pop-Up Store sample storefront writes events to a collection. Atlas Stream Processing builds a session-state document over 10-second windows, and three processors read it over 30-second windows to detect high intent, search friction, and exit risk, writing to a signals collection. A change stream on that collection triggers the decision agent, which uses MCP, Atlas Vector Search, Voyage AI embeddings, and an LLM on Amazon Bedrock, and reads the shopper profile, catalog, promotions, and business rules from the same database. It writes a next best action, which the storefront picks up through its own change stream and shows to the active shopper as a product highlight, a cart message, or a pop-up.
Open standards used
Model Context Protocol (MCP)
Tech stack
MongoDB AtlasAtlas Stream ProcessingAtlas Vector SearchVoyage AIAmazon BedrockPython
Builders

Everyone credited on this solution

Get hands-on

Resources

Next step

Take the code

This one is published in full. Read it, run it, fork it. Nothing here is behind a conversation.

Request an intro

MongoDB is behind this solution. Ask about acting on shopper hesitation in real time, and the MACH Alliance will put you in touch with the person who can answer.

The MACH Alliance passes your details to a named contact at MongoDB who knows this work and can answer your questions. We aim to reply within 2 business days. Your details are handled under the MACH Alliance privacy policy.

Not ready to talk to anyone? MACH Insider is the Alliance mailing list. New solutions, program openings, and the research behind them, once a month.

Keep reading

Related solutions

Verification

Published case study

The detail on this page is drawn from a case study published by the contributor or the MACH Alliance. Any figures on this page are the ones that case study states.

What this page does not establish

  • The storefront is a sample application, so there is no measured lift in conversion or retention.
  • No retailer runs this in production yet.

Where this came from

Written from MongoDB's Solutions Library page, public repository, and blog post on real-time customer retention, and the write-up MongoDB sent the MACH Alliance in October 2026.

Status: Reference prototypeAdded Oct 29, 2026A listing is an editorial decision, not a MACH Alliance certification.

Built something worth showing?

Put your agentic solution in front of the enterprise leaders who use the hub to decide what to build next. Submissions are open to MACH Alliance Members, Collaborators, or Ambassadors.