← All lessons
Day 8 of 90

Prompting Patterns for Commerce Agents

8 min read

Key Concepts

  • 1A good prompt teaches the agent what to do without being brittle. The goal is *role clarity* and *constraint specification.*
  • 2**Role clarity**: Tell the agent what role it plays. Example: 'You are a personal shopping assistant for an outdoor retailer. Your goal is to find the best product for the customer, considering price, quality, and availability.'
  • 3**Constraint specification**: Tell the agent what it can and can't do. Example: 'You must never recommend products you're unsure about. If you're <80% confident, say 'I'm not sure' and ask for clarification.'
  • 4**Specific prompts beat generic**: Instead of 'Find a good laptop,' say 'Find a laptop for a programmer with a $2K budget, who values portability (works from coffee shops), prefers Linux, and has a 1-year warranty requirement.'
  • 5**Few-shot examples**: Give 2-3 examples of good agent behavior. Example: User: 'I want something for hiking.' Agent: 'I'd like to clarify — are you looking for (A) hiking boots, (B) a backpack, (C) a jacket, or (D) something else?' This teaches the agent to ask clarifying questions.
  • 6**Avoid hallucination**: Tell the agent 'If a product is not in our database, you must say so. You must never invent products or prices.' Make the rules explicit.
  • 7**Reasoning transparency**: Ask the agent to 'think step by step.' Example: 'First, identify the user's constraints. Second, search for products. Third, reason about fit. Finally, explain your recommendation.' Step-by-step thinking reduces hallucination.

Why It Matters for PMs

Prompt quality > model quality: A mediocre model with a great prompt can outperform a smart model with a bad prompt. Prompting is a strategic lever for PMs.
Consistency: A good prompt makes agent behavior consistent. Different users get similar-quality explanations, similar reasoning paths, similar confidence levels.
Reducing hallucination: Many hallucinations come from under-constrained prompts. An agent that's told 'make a recommendation' might invent a product. An agent that's told 'only recommend products in our database' won't.

Test Your Understanding

Question 1 (Multiple Choice)

What's more important for agent quality: a smarter model or a better prompt?

Question 2 (Multiple Choice)

Why should you use 'few-shot examples' (examples of good behavior) in a prompt?

Question 3 (Multiple Choice)

If an agent is inventing products (hallucinating), what's the first thing you should do?

Question 4 (Short Answer)

Write a role clarity statement for an agent that sells artisan coffee.

Think about your answer before revealing the explanation.

Question 5 (Short Answer)

Design a few-shot example that teaches an agent to ask clarifying questions.

Think about your answer before revealing the explanation.