Mercury: Agentic AI Platform for LLM-Powered Recommendation Systems

ebay · E-commerce · 2025 · source Agentic: yes · promotional bias: high · source-backed · extracted with prompt 0.5.6 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: E-commerce recommendation systems

eBay needed to use LLMs for personalized recommendations across a marketplace with billions of live listings and hundreds of millions of customers, while keeping recommendations current, low-latency, safe, reusable, and grounded in actual inventory.

Constraints:

Architecture

Mercury is eBay's internal agentic framework and execution platform for LLM-powered recommendation experiences. It packages LLM work as contract-driven Agents, composes agents into Chains, supports online and near-real-time queue-based execution, connects to multiple model providers and internal fine-tuned models, integrates RAG sources, and uses a Listing Matching Engine to translate LLM-generated product ideas into live listings through query expansion, exact retrieval, vector search, anomaly filtering, and personalized ranking.

Diagram confidence: explicit (topology described by the source).

flowchart LR
  UseCase["Recommendation use case"] --> Mercury["Mercury agent framework"]
  Mercury --> Models["Model provider layer"]
  Mercury --> RAG["RAG source layer"]
  Mercury --> NRT["NRT execution platform"]
  Mercury --> LME["Listing Matching Engine"]
  Mercury --> Obs["Observability and metrics"]
  Mercury --> Safety["Safety and moderation layer"]
  RAG --> LME
  LME --> Exact["Exact match retrieval"]
  LME --> Semantic["Semantic vector retrieval"]
  LME --> Filter["Anomaly filtering"]
  Filter --> Ranking["Personalized ranking"]
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Recommendation use case Product experience that asks Mercury for LLM-powered personalized recommendations. Mercury agent framework
Mercury agent framework Contract-based framework for Agents, Chains, model calls, transformation layers, and reusable components. Recommendation use case, Model provider layer, RAG source layer, NRT execution platform, Listing Matching Engine, Observability and metrics, Safety and moderation layer
Model provider layer Internal and external generative model options including internal Llama, Mistral, and Lillium models plus GCP, Azure, and OpenAI. Mercury agent framework
RAG source layer Structured and unstructured sources including user/listing data, Common Crawl content, Google searches, and partner data. Mercury agent framework, Listing Matching Engine
NRT execution platform Distributed queue-based message passing layer for controllable near-real-time throughput, retries, and auto-resume. Mercury agent framework
Listing Matching Engine Retrieval pipeline that maps LLM-generated product ideas and queries to live eBay listings. Mercury agent framework, RAG source layer, Exact match retrieval, Semantic vector retrieval, Anomaly filtering, Personalized ranking
Exact match retrieval Search-engine retrieval optimized for precise product requests. Listing Matching Engine
Semantic vector retrieval Embedding and KNN/vector database retrieval for semantically similar products. Listing Matching Engine
Anomaly filtering Category, price, title-alignment, NSFW, condition, size, location, and use-case hard filters. Listing Matching Engine, Personalized ranking
Personalized ranking Ranks filtered listings based on prior interactions, shopping behavior, preferences, and round-robin diversity. Anomaly filtering
Observability and metrics Monitoring, debugging, reliability, and performance layer for Mercury solutions. Mercury agent framework
Safety and moderation layer Content moderation, LLM safety mechanisms, and internal prompt-injection detection. Mercury agent framework

Data flow

A recommendation use case invokes Mercury agents that transform inputs, call generative models, and optionally compose Chains or agent graphs. RAG sources provide current user, listing, web, and partner context. The LLM produces product names or queries; the Listing Matching Engine expands those queries, runs exact search and embedding/vector retrieval, filters anomalies by category, price, title, and hard constraints, then ranks remaining listings with a personalized model and caches optimized queries when useful.

3 supporting quotes
“In Mercury, a unit of LLM work is structured as an "Agent," which allows us to build AI-powered capabilities with various levels of complexity and autonomy.”article, stated
“While the goal of our recommender system is to generate item recommendations, the LLM produces output text, so we need a way to map text to items.”article, stated
“The ranking process considers the user’s previous interactions, shopping behaviors, and preferences, ensuring that listings are directly aligned with their interests.”article, stated

Why this architecture

Mercury separates agent contracts from internal implementation so teams can reuse and swap components, then relies on queue-based execution to smooth eBay traffic and GPU utilization. RAG handles current knowledge that LLMs lack, while the Listing Matching Engine solves the core mismatch between textual LLM recommendations and eBay's live inventory.

3 supporting quotes
“The abstraction of the input and output data formats away from the internal implementation allows us to have multiple Agents that honor the same contract but differ in complexity, models, implementation, or optimization of quality vs. latency.”article, stated
“Our distributed queue-based message passing system alleviates the need to be tied to users activity pattern at eBay, which typically consists of peaks and valleys throughout the day.”article, stated
“Since LLMs don’t have access to specific current insights into eBay’s dynamic inventory of over two billion live items, we developed this engine to bridge the gap between LLM outputs and our dynamic marketplace”article, stated

Models used: LLMs · Llama · Mistral · Lillium · OpenAI models · BERT-based semantic search models · custom deep learning retrieval models

Scale

Alternatives considered (roads not taken)

Let each team build one-off LLM recommendation systems

Rejected because: Mercury emphasizes reusable contracts, plug-and-play components, and a growing component library across eBay use cases.

“This abstraction also allows the components to be plug-and-play, maintaining strong inter-agent compatibility and reusability.”article, stated
“With every new use case, new components are created or improved on making the entire system better as a whole and larger component library for the next use case.”article, stated

Tie inference directly to user traffic peaks and valleys

Rejected because: That would underutilize GPUs and reserved provider capacity, so Mercury uses queue-based NRT processing to smooth demand.

“These peaks and valleys result in poor utilization of GPUs and allocated reserved capacity from external models.”article, stated
“Our NRT execution platform smooths out this curve to create consistent and controllable throughput in aggregate across all use cases”article, stated

Use only LLM text output as recommendations

Rejected because: LLM output must be mapped to current inventory, so eBay built a Listing Matching Engine.

“While the goal of our recommender system is to generate item recommendations, the LLM produces output text, so we need a way to map text to items.”article, stated
“the Listing Matching Engine connects LLM generated product ideas to live eBay listings, delivering a highly relevant shopping experience.”article, stated

Use exact keyword search alone

Rejected because: eBay combines exact search with semantic embedding retrieval for broad or exploratory user intent.

“Exact Match Retrieval: Call eBay’s search engine with a query based on LLM output.”article, stated
“Generate text embeddings based on LLM output and use KNN search using [Vector Databases]”article, stated

Patterns

multi-agent-orchestration (orchestration)

Mercury treats reusable Agents and Chains as composable units and supports trees or graphs of multiple agents for more autonomous operations.

“Each of these sequences is also presented as an agent, enabling the creation of increasingly complex components while maintaining a consistent interface.”article, stated
“multiple agents can also be configured as trees or graphs to support more autonomous operations, as seen in frameworks like LangGraph.”article, stated

rag-retrieval (knowledge_grounding)

Mercury uses RAG over current listing, user, web, Common Crawl, Google Search, and partner data to keep LLM recommendations timely.

“RAG helps to generate accurate and contextually appropriate responses that the LLMs would otherwise be unable to produce independently”article, stated
“Mercury has the ability to perform Google searches to incorporate real time data from the web to react and produce relevant recommendations”article, stated

tool-use-orchestration (tooling)

Agents expose defined inputs, outputs, transformations, model calls, data sources, retrieval components, and safety tools through a common framework.

“An "Agent," in its simplest form, encapsulates an instruction (prompt) to a Generative Model (e.g., an LLM) along with transformation layers to augment the input data to the expected format”article, stated
“customer teams to build complex systems by combining simple, well-defined parts of inputs and outputs, as you would with any other large-scale applications.”article, stated

eval-driven-development (evaluation)

Mercury treats prompts as code and requires prompt changes to pass pull requests, reviews, unit tests, and functional tests.

“Agents have defined unbreakable contracts, and prompts are treated as code; meaning every change must go through pull requests, reviews, unit testing, and functional testing.”article, stated

observability-tracing (operations)

Mercury includes monitoring and maintenance features for reliability, debugging, and performance monitoring.

“Built-in comprehensive monitoring and maintenance features are integrated, ensuring the reliability, ease of debugging, and performance monitoring of solutions.”article, stated

safety-policy-enforcement (control)

Mercury provides content moderation, LLM safety mechanisms, and internal prompt-injection detection selected according to use-case scale and policy standards.

“Mercury offers access to a range of content moderation models and provides options to integrate LLM safety mechanisms wherever possible.”article, stated
“it includes internal models to detect and prevent prompt injection by malicious actors.”article, stated

Tradeoffs

Use contract-based Agents and Chains

Chose Reusable agent components with stable input/output contracts over Bespoke LLM implementations per recommendation use case.

Rationale: Contracts allow teams to swap models and implementations while preserving inter-agent compatibility and reuse.

“multiple Agents that honor the same contract but differ in complexity, models, implementation, or optimization of quality vs. latency.”article, stated
“components to be plug-and-play, maintaining strong inter-agent compatibility and reusability.”article, stated

Smooth work through NRT queues

Chose Distributed queue-based message passing with controllable throughput over Directly coupling processing to live user-traffic spikes.

Rationale: Queueing improves utilization of GPUs and external model capacity while allowing priorities and parallelism to be adjusted.

“Our NRT execution platform smooths out this curve to create consistent and controllable throughput in aggregate across all use cases”article, stated
“Throughput aperture of parallel processing can also be controlled easily on-the-fly”article, stated

Combine exact match and semantic retrieval

Chose Search-engine exact retrieval plus embedding/KNN vector retrieval over Relying on either lexical matching or semantic retrieval alone.

Rationale: Exact search handles precise product requests, while semantic retrieval handles exploratory or differently worded intent.

“specific product requests like “Samsung Galaxy S22” yield listings closely matching those terms.”article, stated
“retrieve semantically similar items. This suite of embedding models ensures items retrieved closely meet the intent of the LLM’s suggestions but do not necessarily match the exact text used”article, stated

Cache optimized queries when useful

Chose Reuse optimized queries for future needs over Always regenerate and rerank from scratch.

Rationale: Caching can reduce cost and latency, but it must be balanced against freshness in a dynamic inventory marketplace.

“The optimized queries can be saved in our cache for future needs.”article, stated
“Each data source has its pros and cons in terms of latency, relevancy, and costs.”article, stated

Gotchas (what bit them)

LLM product ideas are not directly actionable marketplace recommendations.

Root cause: LLMs output text and lack access to eBay's current dynamic inventory.

Resolution: eBay built the Listing Matching Engine to map generated queries and product ideas to live listings through exact and semantic retrieval.

“the LLM produces output text, so we need a way to map text to items.”article, stated
“we developed this engine to bridge the gap between LLM outputs and our dynamic marketplace to support low latency retrieval needs.”article, stated

User traffic patterns can waste expensive GPU and model-provider capacity.

Root cause: Shopping activity has peaks and valleys, but GPU allocations and external reserved capacity are costly when underutilized.

Resolution: Mercury uses distributed queue-based NRT execution to smooth demand, control throughput, retry failures, and resume after disruptions.

“These peaks and valleys result in poor utilization of GPUs and allocated reserved capacity from external models.”article, stated
“failed tasks are simply retried via our automated retry mechanism at some later time.”article, stated

RAG quality depends on current, relevant data sources with different latency/cost profiles.

Root cause: Current inventory, trends, user context, web data, and partner signals are heterogeneous and stale at different rates.

Resolution: Mercury integrates many structured and unstructured sources and lets each use case choose latency, relevance, and cost tradeoffs.

“access to vast relevant and current information that is structured and unstructured is the ultimate key and challenge.”article, stated
“Each data source has its pros and cons in terms of latency, relevancy, and costs.”article, stated

LLM-generated retrieval results need post-generation validation.

Root cause: Generated product queries can yield listings that mismatch category, price, title, or policy constraints.

Resolution: The Listing Matching Engine applies anomaly detection, category/price validation, title alignment, hard filters, and personalized ranking.

“The engine’s next step is Anomaly Detection and Filtering to maintain relevance and accuracy.”article, stated
“Filtering: Some specific hard filters can be applied, including ones recommended by the LLM, defined in the use case (NSFW, condition, etc.)”article, stated

Evaluation

The article describes production engineering gates and operational monitoring more than offline model metrics: prompts go through pull requests, code reviews, unit tests, and functional tests; Mercury includes observability and metrics; retrieval results are filtered and ranked; and the NRT layer supports retries and auto-resume.

Metrics: hundreds-of-milliseconds latency target · pull requests for prompt changes · unit testing and functional testing · reliability and debugging monitoring · throughput controls per use case · automated retries and auto-resume

3 supporting quotes
“prompts are treated as code; meaning every change must go through pull requests, reviews, unit testing, and functional testing.”article, stated
“Built-in comprehensive monitoring and maintenance features are integrated, ensuring the reliability, ease of debugging, and performance monitoring of solutions.”article, stated
“failed tasks are simply retried via our automated retry mechanism at some later time.”article, stated

Outcomes

The source cites over two billion active listings, hundreds of millions of customers, numerous experiences, latency requirements as low as hundreds of milliseconds, Common Crawl and real-time Google data sources, and industrial-scale execution.

3 supporting quotes
“Mercury, an agentic framework, enables scalable LLM-powered experiences by integrating Retrieval-Augmented Generation (RAG) and a Listing Matching Engine”article, stated
“By leveraging the capabilities of Mercury, eBay is able to add world knowledge encapsulated in the LLM and RAG systems to digest the vast unstructured data in seller listings”article, stated
“The architecture's focus on reusability, ease of productionization, and built-in observability ensures that the solutions are robust, reliable, and maintainable.”article, stated