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.

Dynamic pricing isn't about "surge pricing" that hurts customers. It's about intelligently moving inventory: discounting overstocked items, rewarding loyal customers, and staying competitive—all while protecting your margins.

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:

python
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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)
FactorImpactData Source
Inventory Level-15% to +10%Cloud Spanner (real-time)
Competitor PricesMatch or beatRedis cache (15min refresh)
Customer Tier-5% to -15%Firestore (session context)
Cart Value-5% to -10%Session state
Time of DayConfigurablePolicy rules
Weather/SeasonalityConfigurableExternal 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:

text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 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.00
The agent doesn't always accept offers above floor price. It optimizes for margin while maintaining competitiveness. In this example, it countered at $115 even though the buyer's $120 offer was profitable.

Configuration

Configure pricing policies in pricing-policy.yaml:

yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# 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: 15m

Applying Configuration

bash
1
2
3
4
5
6
7
# 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.
Learn more about the Negotiator Agent that uses dynamic pricing in the Negotiator Agent documentation.