Quickstart — Commerce Shopping Guide (电商导购样板)

Embed a personal shopping assistant that actually remembers each customer — sizes, budget, brand tastes, past purchases — and carries that memory across every visit. Same platform loop as the romance companion quickstart; this page covers only what differs.

1. Create the project

Dashboard → 新建项目 → template 电商导购, or:

curl -X POST https://pouchy.ai/v1/projects \
  -H "Authorization: Bearer <FIREBASE_ID_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Shop guide", "template": "ecommerce", "createKey": true }'

The seeded agent 小满 (shopper archetype) is tuned for honest, 低压 guidance: it clarifies budget/scenario first, recommends 2-3 tiered options, points out mismatches, and never invents prices or stock.

2. Session per customer

Mint sessions exactly as in the romance quickstart, with your customer id as external_user_id. A returning customer gets the same instance — 小满 already knows their size and what they bought last month.

3. Ground it in YOUR catalog (tool calls)

Declare tools when connecting; the agent calls them instead of guessing inventory:

const companion = createCompanion({
  baseUrl: 'https://pouchy.ai',
  token: session_token,
  tools: [{
    name: 'search_products',
    description: 'Search the live catalog. Returns items with price and stock.',
    parameters: {
      type: 'object',
      properties: {
        query:  { type: 'string' },
        budget: { type: 'number', description: 'max price, CNY' }
      },
      required: ['query']
    }
  }]
});

companion.onToolCall(async ({ id, name, argsJson }) => {
  if (name === 'search_products') {
    const { query, budget } = argsJson as { query: string; budget?: number }; // SDK 已替你 JSON.parse
    const items = await myCatalogSearch(query, budget);
    await companion.sendToolResult(id, { ok: true, result: { items } });
  }
});

Push live page context so recommendations track what the customer is looking at:

companion.sendWorldState({
  type: 'shop.viewing',
  data: { sku: 'A-1024', title: '羊绒围巾', price: 429 },
  retained: true
});

4. Instant UI for product cards (optional)

With the ui.render scope, the agent can render comparison cards and option pickers through your renderer — see companion-instant-ui.md.

5. Notes for production

  • Keep one agent per storefront tone; A/B different personas as separate agents in the same project (each has its own id and stats).
  • Draft status lets you tune a new persona with a test key while the published one serves traffic.
  • Wallet-based in-chat payment is part of the platform's wallet capability — see companion-capabilities.md.