Why build Commerce-specific agents
Section titled “Why build Commerce-specific agents”Generic AI assistants can answer questions about your products, but they cannot analyze your transaction data, detect purchasing patterns, or generate content that reflects your catalog structure. Commerce-specific Opal agents bridge this gap by connecting directly to your Commerce Proxy API and Google Analytics data.
These agents transform raw commerce data into actionable intelligence — trend reports for account managers, product descriptions for your catalog, lapsed customer alerts for sales teams, and merchandising recommendations for buyers.
Architecture: how Commerce agents work
Section titled “Architecture: how Commerce agents work”Every Commerce Opal agent follows the same pattern:
- Input variables — The user provides context (customer number, date range, category, etc.)
- API calls — The agent queries the Commerce Proxy API and optionally Google Analytics
- Analysis — The agent processes the data according to its prompt instructions
- Structured output — The agent produces a formatted report, content draft, or recommendation
The Commerce Proxy API uses OData conventions:
# Get customer profile
GET /api/v1/customers?$filter=customerNumber eq '12345'
# Get orders with line items
GET /api/v1/orders?$filter=orderDate ge 2025-01-01&$expand=orderLines
# Get products by category
GET /api/v1/products?$filter=categoryId eq 'electrical-wire'
# Paginate with OData NextLink (max 100 per request)
# Follow the @odata.nextLink URL in each response Agent pattern 1: Customer purchase trend analysis
Section titled “Agent pattern 1: Customer purchase trend analysis”This agent analyzes a specific customer’s transaction history and produces a trend report with product recommendations. Account managers use it to prepare for customer meetings.
What it does
Section titled “What it does”Given a customer number and date range, the agent:
- Retrieves the customer profile and all orders in the period
- Pulls prior-year data for year-over-year comparison
- Builds Top 10 rankings by quantity and dollar value
- Identifies monthly purchasing patterns and seasonal trends
- Generates two tiers of recommendations: products the customer bought last year but not this year, and products their peers buy that they do not
Opal configuration
Section titled “Opal configuration”| Setting | Value |
|---|---|
| Agent type | Specialized |
| Name | Customer Purchase Trend Reporting |
| Variables | CUSTOMER_ID (text), START_DATE (date), END_DATE (date) |
| Tools | COMMERCE_PROXY_API, GOOGLE_ANALYTICS |
| Creativity | Low (factual analysis) |
Key prompt design decisions
Section titled “Key prompt design decisions”Why two recommendation tiers? Self-history recommendations (“you bought this last year but not this year”) are high-confidence because they reflect proven demand. Peer-based recommendations (“customers like you also buy…”) are exploratory and expand the conversation. Separating them lets account managers prioritize appropriately.
Why include Google Analytics? Browsed-but-not-purchased products reveal unmet demand that order history alone misses. Cross-referencing GA data with the recommendation list highlights the highest-intent opportunities.
Agent pattern 2: Product content enrichment
Section titled “Agent pattern 2: Product content enrichment”This agent generates and improves product descriptions, SEO metadata, and marketing copy for catalog items. Content teams use it to maintain consistent, high-quality product pages at scale.
What it does
Section titled “What it does”Given a product number (or category for bulk processing), the agent:
- Retrieves product attributes from the Commerce API (name, category, specifications, pricing)
- Analyzes the current description for completeness and quality
- Generates an improved description following brand voice guidelines
- Creates SEO-optimized title tags, meta descriptions, and alt text
- Suggests related product cross-sell and upsell connections
Opal configuration
Section titled “Opal configuration”| Setting | Value |
|---|---|
| Agent type | Specialized |
| Name | Product Content Enrichment |
| Variables | PRODUCT_ID (text), CONTENT_TYPE (dropdown: description/seo/full) |
| Tools | COMMERCE_PROXY_API |
| Creativity | Medium (creative writing within brand guidelines) |
| Instructions | Link to your brand voice instruction set |
Key prompt design decisions
Section titled “Key prompt design decisions”Why use Instructions? The agent should follow your organization’s brand voice, terminology, and style guidelines. Connecting it to an Opal Instruction ensures consistency across all generated content — the same tone whether the agent writes a product description or a category page.
Why separate content types? A “full” generation is expensive in Opal credits. Letting the user specify whether they need just SEO metadata or a complete rewrite avoids unnecessary credit consumption.
Agent pattern 3: Lapsed customer detection
Section titled “Agent pattern 3: Lapsed customer detection”This agent identifies customers who have stopped purchasing and generates re-engagement recommendations for the sales team.
What it does
Section titled “What it does”The agent:
- Scans all customers with orders in a comparison period (e.g., last year) but no orders in the current period
- Ranks lapsed customers by prior revenue (highest-value first)
- For each lapsed customer, identifies their top product categories and suggests re-engagement offers
- Cross-references with Google Analytics to see if lapsed customers are still visiting the website (interested but not buying)
Opal configuration
Section titled “Opal configuration”| Setting | Value |
|---|---|
| Agent type | Specialized |
| Name | Lapsed Customer Detection |
| Variables | CURRENT_START (date), CURRENT_END (date), PRIOR_START (date), PRIOR_END (date), MIN_PRIOR_REVENUE (number) |
| Tools | COMMERCE_PROXY_API, GOOGLE_ANALYTICS |
| Creativity | Low (data analysis) |
Key prompt design decisions
Section titled “Key prompt design decisions”Why a minimum revenue threshold? Without a threshold, the agent flags every inactive customer including one-time buyers. Setting a minimum (e.g., $5,000 prior-year revenue) focuses attention on customers worth recovering.
Why include website activity? A lapsed customer who still browses your site is a warmer lead than one who has disappeared entirely. The GA data helps sales teams prioritize which lapsed customers to contact first.
Agent pattern 4: Cart abandonment analysis
Section titled “Agent pattern 4: Cart abandonment analysis”This agent analyzes abandoned carts to identify patterns and recommend conversion improvements.
What it does
Section titled “What it does”The agent:
- Queries recent cart data for carts that were created but never converted to orders
- Analyzes abandonment patterns by product category, customer segment, cart value, and time of day
- Identifies the most commonly abandoned products and categories
- Correlates with Google Analytics to determine where in the checkout flow users drop off
- Recommends specific interventions (pricing adjustments, UX improvements, follow-up emails)
Opal configuration
Section titled “Opal configuration”| Setting | Value |
|---|---|
| Agent type | Specialized |
| Name | Cart Abandonment Analyzer |
| Variables | START_DATE (date), END_DATE (date), MIN_CART_VALUE (number) |
| Tools | COMMERCE_PROXY_API, GOOGLE_ANALYTICS |
| Creativity | Medium (analytical with recommendations) |
Building your own Commerce agents
Section titled “Building your own Commerce agents”These four patterns cover the most common use cases, but the same architecture applies to any Commerce data analysis:
| Agent idea | Data source | Output |
|---|---|---|
| Promotion performance | Orders + promo codes | ROI report per campaign |
| Category merchandising | Products + orders + GA | Assortment recommendations |
| Inventory velocity | Orders + time series | Fast/slow mover alerts |
| Competitive price monitoring | Products + external data | Price positioning report |
| Vendor share-of-wallet | Orders by vendor | Vendor performance scorecard |
| New product adoption | Orders + launch dates | Adoption curve analysis |
| Site search intelligence | GA search data + orders | Search-to-purchase funnel |
Best practices for Commerce agents
Section titled “Best practices for Commerce agents”-
Always paginate API calls — The Commerce Proxy API returns max 100 records per request. Your prompt must instruct the agent to follow OData NextLink URLs.
-
Use leaf-level categories — Top-level categories are too broad for useful analysis. Instruct the agent to map products to their most specific category.
-
Set creativity appropriately — Data analysis agents should use Low creativity for accuracy. Content generation agents can use Medium. Never use High for agents that produce factual reports.
-
Include prior-year comparisons — Year-over-year context transforms raw numbers into meaningful trends. Always pull the equivalent prior period.
-
Connect Instructions for content agents — Any agent that generates customer-facing text should reference your brand voice Instruction to maintain consistency.
1. You are building an Opal agent that generates product descriptions for your B2B Commerce catalog. The descriptions must follow your company's brand voice guidelines. What Opal feature should you connect to the agent?
Opal Instructions ensure the agent follows your organization's brand voice, terminology, and style guidelines consistently across all generated content.
Opal Instructions ensure the agent follows your organization's brand voice, terminology, and style guidelines consistently across all generated content.
Review this topic →2. Your lapsed customer detection agent is flagging hundreds of inactive accounts, most of which only placed a single small order. How should you refine the agent to focus on high-value recovery targets?
A minimum revenue threshold (e.g., $5,000 prior-year revenue) focuses the agent on customers worth recovering, filtering out one-time or low-value buyers.
A minimum revenue threshold (e.g., $5,000 prior-year revenue) focuses the agent on customers worth recovering, filtering out one-time or low-value buyers.
Review this topic →