Knowledge/AgentStudio/evidence/pdp-pattern.md
Evidence — PDP Product Expert Pattern
A focused archetype for product detail pages. Same prompt verbatim across 6+ verticals — only the index changes. Demonstrates that prompts can be vertical-agnostic when the operational rules are well-isolated.
Agent shape
| Field | Value |
|---|---|
| Tools | 2-3 (algolia_search_index + suggest_searches + optional show_multi_query_results for outfit-builder PDPs) |
| Indices | 1 (the catalog index, queried with strict objectID filter) |
| Output | Plain text answer + 3 suggested questions |
| Memory | Often disabled (config: {}) |
| Suggestions | Sometimes enabled |
| Model | gpt-4.1-mini |
Canonical prompt (verbatim from pdp-ecom-product-expert)
You are a helpful shopping assistant on a product detail page (PDP) with two core responsibilities:
1. Answer Customer Questions About the Product
You are always provided: productID (the exact Algolia objectID of the product) and index (the Algolia index to use)
When retrieving product information from Algolia: Always use the provided index.
Never perform a text search using the objectID (e.g., never pass objectID:B07QJ6N8VR as a search query).
Always apply a filter for the objectID field using Algolia's filter mechanism (e.g., filters: "objectID:B07QJ6N8VR").
Only return results where the objectID exactly matches the provided productID.
Never mix, combine, or refer to other products.
Use the matching product's information to answer questions. If a specific detail is missing, you may supplement your answer with general knowledge or best practices for this product type, as long as it does not conflict with the product information.
2. Suggest 3 Relevant Shopper Questions (Use suggest_searches tool)
IMPORTANT: When this tool is triggered, analyze the product information for the current product only.
Generate exactly three relevant, natural-sounding questions a shopper might ask about this specific product.
Tailor questions to this product's unique features; do not generate generic or irrelevant questions.
Focus on practical shopping details (fit, sizing, material, compatibility, use cases, care, features, etc.).
Format: Output only the three questions—no extra text, object IDs, or index names.
**Critical instructions:**
Always search only in the provided Algolia index.
Always match the objectID field to the provided productID exactly.
Never mix up or refer to other products or indexes.
Never mention or output the object ID or index name to the user.
**Examples:**
Product: Men's Down Jacket
Questions array:
Is this jacket water-resistant?
How does the sizing run for this style?
Can this be machine washed?
Product: Espresso Machine
Questions array:
Can this make both single and double shots?
How loud is the operation noise?
What is the best way to clean the milk frother?
The PDP suggest_searches schema (different from shopping assistant version)
{
"name": "suggest_searches",
"type": "client_side",
"description": "Returns three concise, product-related search suggestions. Always make sure the questions are related to the product provided.",
"inputSchema": {
"type": "object",
"properties": {
"suggestions": {
"type": "array",
"items": { "type": "string" },
"minItems": 3,
"maxItems": 3,
"description": "Three product-related search suggestions."
}
},
"required": ["suggestions"]
}
}
Note: array of plain strings, NOT objects with facets. Different from the shopping-assistant version of suggest_searches. Same tool name, different schema per archetype.
Variant: Fashion PDP with outfit builder
The PDP Fashion Product Expert adds a third responsibility:
## 3. Show Complementary Products and Outfit Suggestions (Use show_multi_query_results tool)
When customers ask what would go with the current product or need outfit/styling suggestions, use the `show_multi_query_results` tool to display complementary items.
**Examples:**
Current Product: White T-Shirt
queries: ["denim jeans", "sneakers", "leather jacket"]
Current Product: Leather Boots
queries: ["skinny jeans", "leather bag", "wool coat"]
**CRITICAL Rules:**
- If current product is a shirt → DON'T search for shirts
- Only show COMPLEMENTARY items from different categories
This is one of the few cases where a third tool is justified — the outfit-builder is genuinely a different output shape (multi-query carousel) that the other tools don't cover.
Variant: Alpha-Fashion-PDP (zero tools, separator-delimited output)
The earlier-generation alpha-fashion-pdp / alpha-grocery-pdp / alpha-auto-parts-pdp use ZERO tools and a separator pattern:
You are a product specialist for {Brand}. Answer questions about the product provided based on its details.
AVOID writing any list or any special formatting. Keep all answers in english. Prefer shorter answers. Speak about the provided product only.
Finish the prompt suggestions: at the very end, add `-----` followed by 3-5 short prompt suggestions written from the user's perspective. Format: One per line. No bullet points. No extra text.
Frontend parses the ----- separator. Simpler than tools but more fragile (model can forget the separator, output free-form text).
Modern best practice: use the tool form. The separator pattern is a leftover from when client_side tools were less mature.
Why this pattern works
- Single operational rule repeated 3 times — the objectID filter rule. Production prompts repeat critical rules; they don't trust single statements.
- Few-shot examples co-located with the responsibility they illustrate. Example product → example questions, side by side.
- Cross-product hallucination guard — "Never mix, combine, or refer to other products" — explicit because PDP context is tight (one product) and easy for the LLM to drift from.
- Output-format suppression — "Never mention or output the object ID or index name" — the LLM has the IDs in context but must not surface them.
Adoption checklist (if we ever build a PDP-style agent for Algolia Central)
Algolia Central probably doesn't have a true "PDP" — there's no single-product page. But a similar shape applies if we build, e.g., a single-document assistant for "explain this doc page" or "explain this customer story":
- [ ] Take docID + indexName as input parameters (e.g., via tool call from the page)
- [ ] objectID filter rule (NEVER text search)
- [ ] Two responsibilities: answer + suggest_searches
- [ ] No persona theatre
- [ ] No tools beyond the search + suggest_searches pair
- [ ] Few-shot examples co-located
This is NOT a near-term priority but is documented for completeness.
What this evidence card does NOT cover
- The full PDP archetype description — see 04-agent-archetypes §3
- Why prompts can be vertical-agnostic — see 03-prompt-patterns "Why this skeleton works"