RRetailAgentOS

Architecture Notes

How vendor-scoped extensions layer on top of core UCP to give agents the retail semantics they need before checkout.

The contract you can build with: UCP gives the rails — discovery, catalog, cart, checkout handoff. The extension layer on top produces four computed output shapes that agents (or any downstream system) consume: ComputedVisibility, ComputedEligibility, ComputedPriceState, and CartValidationResult. Every decision is deterministic and inspectable — see the live Playground to inspect these contracts in real time.
The whole model at a glance
Buyer query flows through UCP rails, into the extension layer of merchant rules, which produces four computed outputs that let the agent act correctly.Buyer queryvia AI agentUCP railsdiscovercartcheckoutExtension layermerchant ruleseligibility · pricing4 computed outputsComputedVisibilityComputedEligibilityComputedPriceStateCartValidationResultAgentactscorrectly

The Three-Layer Model

This project operates in three distinct layers. Each builds on the one below it and exposes a clear contract upward — read the stack bottom-up.

Three-layer stack: Layer 1 core UCP rails at the bottom, Layer 2 vendor-scoped extensions in the middle that extend it, and Layer 3 computed retail semantics on top that evaluates the extension rules.LAYER 3 · COMPUTED RETAIL SEMANTICSWhat the agent evaluates and acts on — deterministic, derived at request timeComputedVisibilityComputedEligibilityComputedPriceStateCartValidationResultevaluates rules in ↑LAYER 2 · VENDOR-SCOPED EXTENSIONSHow merchant retail rules are declared — namespaced schemas attached to variantsext.pricing_contextext.eligibilityext.bulk_pricingext.promo_pricingext.fulfillment_constraintsextends and builds on ↑LAYER 1 · CORE UCP PROTOCOLProtocol rails: discover, transact, hand off — unchanged, not redefineducp.catalog.discoveryucp.cart.managementucp.checkout.init

Computed Output Contracts — What Agents Consume

The extension layer resolves to four deterministic output shapes. These are what an agent, UI, or downstream system reads to make decisions — not raw merchant config, but computed results with reasons.

Buyer context plus extension rules are evaluated to produce four computed output contracts: ComputedVisibility, ComputedEligibility, ComputedPriceState, and CartValidationResult.buyer contextextension rulesevaluatedeterministicComputedVisibilityComputedEligibilityComputedPriceStateCartValidationResult
ComputedVisibility
{ status: 'VISIBLE' | 'HIDDEN', reason?: string }

Tells an agent whether to surface the item to this buyer. HIDDEN includes the reason why.

ComputedEligibility
{ status: 'ELIGIBLE' | 'CONDITIONAL' | 'BLOCKED', reasons: EligibilityReason[] }

Tells an agent whether a purchase is valid. Each reason has a code, message, and blocking flag.

ComputedPriceState
{ unitPrice, priceSource: 'base'|'member'|'bulk_tier'|'promo_sale'|'promo_tier', appliedTier?, teaser? }

The resolved price with its source. teaser surfaces "add 5 more for 10% off"-style prompts.

CartValidationResult
{ valid, lines[{ lineId, valid, unitPrice, lineTotal, eligibility, priceSource, messages[] }], cartTotal }

Full cart-level validation — each line validated against the live context.

The Agentic Commerce Gap

Without this extension layer, AI shopping agents encounter checkout-time failures that could have been prevented at catalog time. The same buyer journey runs two ways:

Two parallel tracks. Without the extension, problems are only discovered at checkout and fail. With the extension, the same constraints are caught at catalog time and the agent succeeds.CATALOGCARTCHECKOUTWITHOUTno constraints surfaceditem shown anywaywrong price / qty in cart✗ checkout failsWITHcaught at catalog timehidden / labeled / pricedvalid cart, correct price✓ checkout succeeds

Each row below shows a concrete scenario — what fails without the extension, and how the extension resolves it.

Without ExtensionImpact on AgentWith Extension
Wholesale item shown to guest buyer
Agent surfaces a product the buyer cannot purchase — checkout fails with a cryptic errorext.eligibility returns HIDDEN for guests — agent never surfaces it
List price shown to wholesale member
Agent quotes wrong price — buyer is surprised at checkout with a different numberext.member_pricing / ext.bulk_pricing returns correct contextual price before cart
Cart quantity below MOQ
Agent builds a cart that fails validation at checkout — buyer abandonsext.bulk_pricing exposes MOQ — agent enforces it during cart construction
Item ordered for shipping to restricted region
Checkout blocks the item — agent had no way to know it was region-restrictedext.fulfillment_constraints surfaces restriction at catalog time — agent routes correctly

Extension Namespace Reference

All vendor-scoped extensions use a namespaced ID to prevent collisions across merchants and protocol versions. Extensions are declared in the merchant's UCP profile and attached to product variants.

ext.pricing_context
com.os.retailagent.shopping.pricing_context
Required

Carrier of buyer context: customer type, tier, region, fulfillment mode, tax state. All other extensions consume it.

Active in:Boutique AWholesale BGrocery C
ext.eligibility
com.os.retailagent.shopping.eligibility
Required

Structured visibility and eligibility reasoning. Returns VISIBLE/HIDDEN and ELIGIBLE/CONDITIONAL/BLOCKED with machine-readable reason codes.

Active in:Boutique AWholesale BGrocery C
ext.member_pricing
com.os.retailagent.shopping.member_pricing

Member-exclusive pricing, teaser pricing for upsell, and locked price states for unqualified buyers.

Active in:Wholesale B
ext.bulk_pricing
com.os.retailagent.shopping.bulk_pricing

Minimum Order Quantities (MOQ), quantity increments, and volume-based price tier selection.

Active in:Wholesale B
ext.promo_pricing
com.os.retailagent.shopping.promo_pricing

Sale pricing, mix-and-match quantity thresholds, and applied offer state declarations.

Active in:Grocery C
ext.fulfillment_constraints
com.os.retailagent.shopping.fulfillment_constraints

Mode and region availability restrictions surfaced at catalog time, not checkout time.

Active in:Grocery C
ext.loyalty
com.os.retailagent.shopping.loyalty
Future

Earn/burn preview mechanics, account-linked state, member benefit summaries. (Future — not yet spec'd)

ext.intent_capture
com.os.retailagent.shopping.intent_capture
Future

Non-checkout commerce outcomes: WhatsApp handoff, lead form routing, assisted sales callbacks. (Future — not yet spec'd)

Core UCP vs Vendor Extensions

The Unified Commerce Protocol (UCP) standardizes the core rails of digital commerce. But retail semantics — how things are priced, who can buy them, and under what conditions — are fundamentally specific to each merchant and business model.

This demo applies a clear separation of concerns:

  • Core UCP provides discovery, cart lifecycle, and transaction handoff. It defines what can be done.
  • Vendor Extensionsprovide the "why" and "under what conditions." They encapsulate the rules for eligibility, dynamic pricing, and fulfillment constraints. They define whether it should be done, and at what terms.

The extension model is deliberately vendor-scoped (namespaced) so that merchants can evolve their own semantics without requiring changes to the core protocol.

Why Pre-Checkout Retail Logic Matters

Historically, complex pricing and eligibility logic is evaluated late in the funnel — at checkout. This leads to poor agent and user experiences: an AI shopping agent that builds a cart using the wrong price, the wrong quantity, or a product the buyer cannot purchase.

By surfacing Eligibility, PricingContext, and BulkPricing extensions early — at catalog browsing and cart stages — agents and UIs can:

  • Hide or label products the current buyer context cannot access.
  • Show the exact applicable price before adding to cart.
  • Provide actionable feedback during discovery: "Add 5 more for a 10% discount."
  • Route to intent capture instead of checkout when qualification is missing.

This is a Learning Journey

This project is a demonstration and a learning vehicle — not a production UCP server, not a complete ecommerce platform, not a competing protocol.

It exists to test and validate ideas around agentic commerce and structured retail semantics. The long-term goal is to identify extension patterns that could eventually be proposed upstream into the broader UCP ecosystem.