Dynamic Pricing
Real-time, margin-aware pricing that enables intelligent agent negotiation.
Overview
Traditional e-commerce uses static pricing—a product costs $150 regardless of inventory, competition, or customer loyalty. Dynamic Pricing in Hyperfold calculates optimal prices in real-time based on multiple factors.
Key benefits:
- Automated inventory clearance: Overstocked items get discounted automatically
- Competitive positioning: Stay within market range without manual monitoring
- Margin protection: Floor prices ensure profitability
- Customer loyalty: Reward repeat customers with better prices
Pricing Factors
Hyperfold considers multiple factors when calculating dynamic prices:
def calculate_dynamic_price(product, context): """ Real-time pricing calculation for agent negotiation. """ base_price = product.list_price floor_price = product.cost * (1 + product.min_margin) # Factor 1: Inventory pressure if product.stock_level == "overstock": price_adjustment = -0.15 # Up to 15% discount elif product.stock_level == "low": price_adjustment = 0.05 # 5% premium else: price_adjustment = 0 # Factor 2: Competitor pricing competitor_price = context.get("competitor_price") if competitor_price and competitor_price < base_price: # Match or beat competitor, but respect floor price_adjustment = min(price_adjustment, (competitor_price - base_price) / base_price) # Factor 3: Customer loyalty if context.get("loyalty_tier") == "gold": price_adjustment -= 0.10 # Extra 10% for gold members # Factor 4: Bundle opportunity if context.get("cart_value") > 200: price_adjustment -= 0.05 # Volume discount # Calculate final price (never below floor) dynamic_price = base_price * (1 + price_adjustment) return max(dynamic_price, floor_price)| Factor | Impact | Data Source |
|---|---|---|
| Inventory Level | -15% to +10% | Cloud Spanner (real-time) |
| Competitor Prices | Match or beat | Redis cache (15min refresh) |
| Customer Tier | -5% to -15% | Firestore (session context) |
| Cart Value | -5% to -10% | Session state |
| Time of Day | Configurable | Policy rules |
| Weather/Seasonality | Configurable | External APIs |
Margin Guardrails
Every dynamic pricing calculation is bounded by guardrails that protect your business:
Floor Price
The absolute minimum price, calculated as cost × (1 + min_margin). Agents can never go below this, even under heavy negotiation.
Max Discount
Maximum percentage off list price (e.g., 30%). Prevents runaway discounting even when inventory and competition pressures align.
Approval Threshold
Discounts above a dollar amount (e.g., $50 off) require human approval before the agent can offer them.
Daily Limits
Cap total discounts per day to prevent exploitation. When hit, agents revert to list price.
Negotiation Strategies
Watch how the Negotiator Agent uses dynamic pricing during a real negotiation:
# Agent negotiation session log[INFO] Buyer offer: $120 for SKU_991 (list: $150) [DATA] Loading pricing context... - Cost: $80 - Min margin: 15% - Floor price: $92 - Current stock: 847 units (OVERSTOCK) - Competitor price: $142 (Amazon) - Customer: Gold tier, 12 past orders [CALC] Base adjustments: - Overstock discount: -15% - Beat competitor: -5% (to $142) - Gold loyalty: -10% - Raw adjusted: $105 [GUARD] Floor check: $105 > $92 ✓ [THOUGHT] Buyer offered $120, which is ABOVE my floor of $92. However, I can counteroffer at $115 to maximize margin. This still beats Amazon by $27. [ACTION] COUNTER_OFFER Price: $115 Reasoning: "I can do $115 - that's 23% off and beats Amazon" [OUT] ACP Response: counter_offer, price=115.00Configuration
Configure pricing policies in pricing-policy.yaml:
# pricing-policy.yaml default_strategy: dynamic_margin rules: # Overstock clearance - condition: "inventory.days_on_hand > 90" action: "reduce_margin" params: max_discount: 0.25 # Low stock premium - condition: "inventory.quantity < 10" action: "premium" params: markup: 0.10 # Competitor matching - condition: "competitor.price < list_price" action: "match_competitor" params: beat_by: 0.02 # Beat by 2% respect_floor: true # Loyalty tiers - condition: "customer.tier == 'gold'" action: "tier_discount" params: discount: 0.10 - condition: "customer.tier == 'silver'" action: "tier_discount" params: discount: 0.05 guardrails: min_margin_percent: 15 max_discount_percent: 30 require_approval_above: 500 competitive_intel: sources: - amazon - walmart - target refresh_interval: 1h cache_ttl: 15mApplying Configuration
# Apply pricing policy$ hyperfold config apply ./pricing-policy.yaml > [Validate] Checking rule syntax... OK> [Firestore] Uploading policy to 'policies/pricing'> [Agents] Notifying active agents of policy update> [SUCCESS] Policy applied. Active agents will use new rules immediately.