Chain of Thought Logs

Understand agent reasoning with detailed decision traces.

Overview

Chain of Thought (CoT) logs capture the complete reasoning process of your agents during negotiations and commerce operations. Every decision, consideration, and outcome is logged for transparency and debugging.

CoT logs are essential for understanding why agents make specific pricing decisions and for optimizing negotiation strategies over time.

Viewing Logs

bash
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
48
49
50
51
52
53
54
55
56
57
# View Chain of Thought logs for a session
$ hyperfold logs cot --session=sess_abc123
CHAIN OF THOUGHT: sess_abc123
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Agent: sales-negotiator
Customer: cust_xyz (Gold tier)
Product: AeroRun X2 Waterproof
Duration: 32.5s
Outcome: conversion @ $155.00
REASONING TRACE
[10:15:00.100] CONTEXT LOADED
│ Customer tier: gold (12 previous orders, $1,840 LTV)
│ Product: AeroRun X2, MSRP $179.99, floor $135.00
│ Inventory: 45 units (healthy)
│ Competitor price: $169.99
[10:15:00.450] SEARCH RECEIVED
│ Query: "waterproof running shoes for marathon"
│ Semantic confidence: 0.94
│ Matched products: 8
│ Primary recommendation: AeroRun X2 (highest relevance)
[10:15:01.200] INITIAL OFFER: $150.00
│ Analysis: Offer is $29.99 below MSRP (16.7% discount)
│ Floor check: $150 > $135 (above floor) ✓
│ Customer context: Gold tier, high LTV, flexible urgency
│ Competitor gap: $19.99 below competitor
│ Decision: COUNTER_OFFER at $162.00 (10% discount)
│ Reasoning: Gold members typically expect 10-15% discount.
│ Counter at 10% leaves room for negotiation while
│ maintaining healthy margin (46%).
[10:15:05.800] COUNTER OFFER: $155.00
│ Analysis: Customer countered $7 below our offer
│ Margin at $155: 44.4% (acceptable)
│ Customer signals: Mentioned marathon training (urgency cue)
│ Decision: ACCEPT at $155.00
│ Reasoning: Customer showed purchase intent with marathon
│ mention. $155 maintains 44% margin and builds
│ loyalty. Small concession ($7) worth the conversion.
[10:15:06.100] BUNDLE SUGGESTION
│ Complementary: Waterproof Running Socks ($29.99)
│ Bundle price: $179.99 (saves $5)
│ Decision: OFFER_BUNDLE
│ Customer response: Declined
[10:15:32.500] CHECKOUT COMPLETE
│ Final price: $155.00
│ Discount given: 13.9%
│ Margin achieved: 44.4%
│ Session duration: 32.5s
│ Negotiation rounds: 2

Log Structure

Each CoT entry contains the full context and reasoning for a decision:

json
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
# Log entry structure
{
"session_id": "sess_abc123",
"timestamp": "2025-01-20T10:15:01.200Z",
"agent": "sales-negotiator",
"event_type": "reasoning",
"step": "price_decision",
"input": {
"offer_price": 150.00,
"product_id": "prod_aero_x2",
"customer_tier": "gold"
},
"context": {
"product_floor": 135.00,
"product_msrp": 179.99,
"customer_ltv": 1840.00,
"competitor_price": 169.99,
"inventory_level": 45
},
"reasoning": {
"thought": "Customer offer of $150 is 16.7% below MSRP...",
"considerations": [
"Gold tier typically expects 10-15% discount",
"Offer above floor price - acceptable",
"High customer LTV suggests retention priority"
],
"decision": "counter_offer",
"confidence": 0.85
},
"output": {
"action": "counter_offer",
"price": 162.00,
"message": "I can offer you our Gold member price of $162..."
},
"metrics": {
"llm_tokens": 847,
"llm_latency_ms": 130,
"total_latency_ms": 250
}
}

Key Fields

FieldDescription
reasoning.thoughtNatural language reasoning from LLM
reasoning.considerationsFactors weighed in decision
reasoning.confidenceAgent's confidence in decision (0-1)
contextBusiness data available to agent
metricsPerformance metrics for the step

Analysis

bash
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
48
49
# Analyze CoT logs for insights
$ hyperfold logs cot analyze --since=7d
COT ANALYSIS (7 days)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
SESSIONS
Total: 4,521
Conversions: 1,492 (33.0%)
Avg Rounds: 2.3
Avg Duration: 28.4s
PRICE DECISIONS
Accept (first): 12%
Counter once: 45%
Counter twice: 31%
Reject: 12%
REASONING PATTERNS
Customer tier cited: 78%
Competitor price: 34%
Inventory level: 23%
Urgency signals: 45%
TOP REJECTION REASONS
1. Below floor price (67%)
2. Inventory constraints (18%)
3. Policy violation (15%)
# Search for specific reasoning patterns
$ hyperfold logs cot search \
--query="inventory" \
--outcome=rejected \
--since=24h
Found 23 sessions where inventory was cited in rejection:
SESSION PRODUCT REASONING
sess_xyz001 Widget Pro "Low inventory (3 units) - holding firm on price"
sess_xyz002 Gadget Max "Out of stock at closest warehouse"
...
# Export for analysis
$ hyperfold logs cot export \
--since=30d \
--format=jsonl \
--output=cot-logs-january.jsonl
Exported 45,210 reasoning entries to cot-logs-january.jsonl

Debugging

Use CoT logs to understand and improve failed negotiations:

bash
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
48
49
50
51
52
53
54
# Debug a specific failed negotiation
$ hyperfold logs cot --session=sess_failed_001 --verbose
CHAIN OF THOUGHT: sess_failed_001
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Agent: sales-negotiator
Customer: cust_new (Standard tier)
Outcome: abandoned
[10:30:00.100] CONTEXT LOADED
│ Customer tier: standard (0 previous orders)
│ Product: Premium Widget, MSRP $299.99, floor $250.00
[10:30:01.500] INITIAL OFFER: $200.00
│ Analysis: Offer is $99.99 below MSRP (33.3% discount)
│ Floor check: $200 < $250 (BELOW FLOOR) ✗
│ Decision: REJECT
│ Response: "I appreciate your interest, but our best price
│ for this item is around $250."
[10:30:15.000] SECOND OFFER: $220.00
│ Analysis: Still below floor ($30 gap)
│ Decision: REJECT
│ Response: "I understand you're looking for a good deal.
│ The lowest I can go is $250."
[10:30:45.000] SESSION TIMEOUT
│ Customer did not respond for 30 seconds
│ Session marked as abandoned
DEBUG NOTES
⚠ Customer was new (no loyalty benefits)
⚠ Large gap between offer and floor (20%)
⚠ No bundle or alternative suggested
RECOMMENDATIONS
1. Consider offering entry-level alternative
2. Suggest financing options for new customers
3. Offer smaller discount for email signup
# Replay session with different parameters
$ hyperfold logs cot replay sess_failed_001 \
--override-floor=220 \
--dry-run
REPLAY SIMULATION (dry-run)
With floor=$220:
- First offer ($200): Still rejected (below floor)
- Second offer ($220): ACCEPTED
Simulated outcome: CONVERSION at $220
Margin impact: 26.7% vs minimum 16.7%
Set up alerts for unusual reasoning patterns with Alerting.