---
title: Recommend a seller
description: Navigation quality, TypeScript SDK example and recorded choice for the shopping benchmark.
sidebar:
  label: Shopping
---

**KPI** · Purchase probability plus on-time fulfillment probability.

![Navigation score by prior navigations per World.](/docs/benchmarks/industry-shopping.png)

## After 1,000 navigations per World

Spacefolder chose the highest-value action on **96 of 96** held-out navigations.

| Approach | Expected utility | Score / 100 |
| --- | ---: | ---: |
| Spacefolder | 1.053 | 100.00 |
| Vector search + SQL for matching situations¹ | 1.053 | 100.00 |
| SQL for all situations¹ | 1.002 | 67.71 |
| First listed action | 0.730 | 32.29 |
| Ground truth | 1.053 | 100.00 |

¹ Stack analogies. The replay averaged each action’s outcomes in memory, grouping by exact situation for the first baseline and pooling all situations for the second.

## TypeScript SDK example

[TypeScript SDK](/docs/reference/sdks#typescript-and-javascript) · [Navigate API](/docs/reference/api/navigate/navigate)

```ts
import { SpacefolderClient } from "@spacefolder/sdk";

const sf = new SpacefolderClient();
const navigation = await sf.navigate({
  nav_id: crypto.randomUUID(),
  world_id: "shopping_example",
  entity_type: "shopping_order",
  entity_id: "shopper-trip:headphone-order",
  context: { scene: "Urban delivery with a flexible budget" },
  actions: {
    sound_direct: {"name": "shopping.offer_recommended", "data": {"seller_id": "sound_direct", "sku": "headphones"}},
    city_audio: {"name": "shopping.offer_recommended", "data": {"seller_id": "city_audio", "sku": "headphones"}},
  },
  predictions: {
    purchased: {"event": "order.placed", "horizon": "1h"},
    on_time: {"event": "delivery.on_time", "horizon": "2d"},
  },
});

let chosen: string | undefined;
let best = -Infinity;
for (const action of ["sound_direct", "city_audio"] as const) {
  const purchased = navigation.actions?.[action]?.predictions.purchased;
  if (!purchased || !("probability" in purchased) || typeof purchased.probability !== "number") continue;
  const on_time = navigation.actions?.[action]?.predictions.on_time;
  if (!on_time || !("probability" in on_time) || typeof on_time.probability !== "number") continue;
  const utility = purchased.probability + on_time.probability;
  if (utility > best) {
    best = utility;
    chosen = action;
  }
}
console.log(JSON.stringify({ chosen }, null, 2));
```

## Example output

**Urban delivery with a flexible budget**

```json
{
  "chosen": "sound_direct"
}
```

Recommend the selected seller and record the actual purchase and on-time fulfillment against that order. Keep orders with incomplete delivery coverage unresolved.
