Skip to main content
Status: Live in Playground · Try it: synap.maximem.ai/playground Open the playground and pick Amazon: Shopping Assistant to see the reference implementation running before you build.
A shopping concierge that knows the buyer’s order history, dietary and material preferences, brand affinities, and recent searches. It grounds product suggestions in the live catalog via tools and handles tracking, returns, and re-orders, all while learning preferences across sessions.

What you’ll build

A chat agent that:
  • Searches the catalog with the buyer’s preferences applied as filters by default
  • Recalls preferences: dietary restrictions, allergies, sizes, materials, brand likes/dislikes
  • Grounds in order history: “find me another of those running shoes I bought in March”
  • Handles post-purchase: tracking, returns, replacement orders
Est. build time: 30 to 45 minutes (assuming you already have catalog and orders APIs).

When to use this recipe

Build this if your product:
  • Has a sizeable catalog where suggestion quality matters
  • Tracks per-buyer order history you want the agent to reference
  • Wants the agent to remember preferences across visits without making the buyer re-state them
  • Needs the agent to take post-purchase actions (track, return, replace)

Architecture at a glance

Amazon shopping assistant architecture diagram showing chat, backend, Synap memory fetch, LLM with catalog and order tools, and turn ingestion
Preferences and order context auto-organize into a MACA; you don’t define the fields; the SDK does.

Stack

Prerequisites

  • A Synap API key, see Authentication
  • Internal APIs for catalog search, product details, orders, and returns
  • Python recipe: Python 3.11+
  • TypeScript recipe: Node 18+ and Python 3.11+ on the host
TypeScript recipe runs on Node only. Pin Next.js route handlers to export const runtime = "nodejs". See Installation → JavaScript / TypeScript SDK.

Install

Configure

Build it

1. Identity & scoping

  • customer_id = "amazon": single tenant
  • user_id = <stable buyer ID>: from authenticated session
  • conversation_id = <session UUID>: per chat session
conversation_id, user_id, and customer_id must be valid UUIDs. Generate session ids with crypto.randomUUID() (JS) or str(uuid.uuid4()) (Python), as shown below.

2. Business tools

3. System prompt

System prompt

4. Wire memory + LLM + tools

Run & verify

Session 1
Session 2 (a week later, new conversation_id)
The second session is a fresh conversation. Synap surfaces the prior order and the soy allergy without you wiring them by hand.

Inspect what got stored

Customize / extend

Troubleshooting

Assistant ignores known allergies / dietary prefs
  • Confirm synap_search is being called (Python); inspect the agent trace. If the model isn’t calling it, sharpen the system prompt: “Before recommending food, beauty, or supplements, call synap_search for the buyer’s restrictions.”
  • For the TS path with synap.wrap, increase maxResults so the dietary memory makes it into the injected context.
Same product suggested over and over
  • The agent has the buyer’s affinity but no negative feedback. Capture explicit rejections (“I didn’t like that one”) with synap_store, or post-purchase ratings via your own pipeline → sdk.memories.create.
Order history out of sync
  • Order data should be tool-fetched live, never cached in memory. If you see stale orders in suggestions, your tool is returning cached data, not Synap.