Skip to main content

What is Memory Replay?

Memory Replay allows you to reconstruct and analyze complete sequences of agent decisions, providing a comprehensive view of how your AI agents process information and make choices over time. Think of it as a “time machine” for your agent’s thought process.

Key Features

1. Complete Session Reconstruction

View entire conversation flows with full context:

Chronological Timeline

See events in the exact order they occurred

Decision Context

Understand what information was available at each step

State Changes

Track how agent state evolved over time

Branching Paths

See where different decisions could have been made

2. Interactive Playback

Control how you review agent behavior:
  • Step-by-Step
  • Fast Forward
  • Slow Motion
  • Breakpoints
Move through decisions one at a time to understand the logic

3. Multi-Perspective Analysis

View the same session from different angles:
See what the agent was thinking and why
Understand the user experience and satisfaction
Monitor resource usage and performance
Analyze costs, outcomes, and business impact

How It Works

1. Session Tracking

Every user session is automatically tracked:
// Sessions are created automatically
const session = {
  id: "session_123abc",
  user_id: "user_456def",
  start_time: "2024-01-15T10:30:00Z",
  end_time: "2024-01-15T10:45:00Z",
  total_tool_calls: 23,
  total_cost: 0.45,
  outcome: "successful"
};

2. Event Capture

All agent actions are recorded with rich metadata:
{
  type: "tool_call",
  timestamp: "2024-01-15T10:32:15Z",
  tool_name: "search_products",
  arguments: {
    query: "wireless headphones",
    filters: { price_max: 200 }
  },
  reasoning: "User wants headphones under $200, searching catalog",
  confidence: 0.92,
  alternatives: ["browse_categories", "ask_preferences"],
  result: {
    products: [...],
    count: 15,
    execution_time: 234
  }
}

3. State Reconstruction

Agent state is reconstructed at any point in time:
// State at specific timestamp
const stateAtTime = {
  timestamp: "2024-01-15T10:32:15Z",
  context: {
    user_preferences: {
      budget: 200,
      brand_preference: "Sony",
      use_case: "gaming"
    },
    conversation_history: [...],
    available_tools: ["search_products", "get_reviews", "check_inventory"],
    current_goal: "find_suitable_headphones"
  },
  memory: {
    facts: ["user_likes_wireless", "budget_is_200", "needs_good_sound"],
    constraints: ["wireless_required", "budget_under_200"],
    preferences: ["sony_preferred", "gaming_focused"]
  }
};

Using Memory Replay

1. Access from Dashboard

Navigate to Dashboard → Memory Replay and select:
1

Choose Session

Select a session from the list or search by user/time
2

Set Playback Speed

Choose how fast to replay the session
3

Select Perspective

Choose which viewpoint to analyze from
4

Start Replay

Watch the session unfold with full context

2. Programmatic Access

Access replay data via API:
const replay = await client.getSessionReplay({
  sessionId: "session_123abc",
  includeState: true,
  includeReasoning: true,
  format: "timeline"
});

// Navigate through events
replay.events.forEach(event => {
  console.log(`${event.timestamp}: ${event.type}`);
  console.log(`Reasoning: ${event.reasoning}`);
});

Use Cases

1. Debugging & Troubleshooting

Error Investigation

Trace back to see exactly what led to errors

Performance Analysis

Identify bottlenecks and slow decision points

Logic Validation

Verify agent reasoning matches expectations

Edge Case Analysis

Understand how agents handle unusual situations

2. Optimization & Improvement

  • Prompt Engineering
  • Model Comparison
See how different prompts affect decision quality:
// Compare different prompt versions
const promptA_sessions = await client.getSessionsByPrompt("v1.0");
const promptB_sessions = await client.getSessionsByPrompt("v1.1");

// Analyze success rates
const comparison = {
  promptA: { success_rate: 0.82, avg_confidence: 0.75 },
  promptB: { success_rate: 0.89, avg_confidence: 0.83 }
};

3. Compliance & Auditing

Complete record of all decisions for compliance:
  • Regulatory compliance - Meet audit requirements
  • Decision justification - Explain AI choices to stakeholders
  • Risk assessment - Identify potential compliance issues
Identify potential biases in decision patterns:
  • Pattern analysis - Look for systematic biases
  • Fairness metrics - Measure decision fairness
  • Corrective actions - Implement bias mitigation
Ensure consistent decision quality:
  • Standard adherence - Verify decisions follow guidelines
  • Deviation detection - Flag unusual patterns
  • Continuous improvement - Learn from each session

Advanced Features

1. Counterfactual Analysis

Explore “what if” scenarios:
// Analyze alternative paths
const counterfactual = await client.analyzeCounterfactual({
  sessionId: "session_123abc",
  changePoint: "2024-01-15T10:32:15Z",
  alternative: "browse_categories",
  reasoning: "What if agent chose to browse categories instead of searching?"
});

// Compare outcomes
const comparison = {
  original: { success: true, cost: 0.45, time: 15 },
  counterfactual: { success: true, cost: 0.38, time: 18 }
};

2. Pattern Recognition

Identify recurring decision patterns:

Success Patterns

Patterns that lead to successful outcomes

Failure Patterns

Patterns that commonly lead to errors

Efficiency Patterns

Patterns that optimize for speed/cost

User Satisfaction

Patterns that improve user experience

3. Collaborative Analysis

Share replays with team members:
  • Annotations
  • Bookmarks
  • Comments
  • Export
Add notes and observations to specific events

Best Practices

1. Effective Analysis

Focus on learning rather than just problem-solving. Each replay session should generate insights for future improvements.
1

Define Goals

Know what you’re looking for before starting the replay
2

Take Notes

Document observations and insights as you watch
3

Look for Patterns

Don’t just analyze single events - look for trends
4

Test Hypotheses

Use replays to validate or refute theories about agent behavior

2. Collaborative Review

  • Regular Sessions
  • Cross-Functional
  • Structured Process
  • Action Items
Schedule weekly replay review sessions with your team

3. Privacy & Security

Be mindful of sensitive information in replays:
  • Anonymize user data - Remove or mask personal information
  • Access controls - Limit who can view sensitive sessions
  • Retention policies - Set appropriate data retention periods
Ensure replay analysis complies with regulations:
  • GDPR compliance - Respect user privacy rights
  • Industry regulations - Follow sector-specific requirements
  • Audit trails - Maintain records of who accessed what

Integration with Other Tools

1. Export Options

const exportData = await client.exportSessionReplay({
  sessionId: "session_123abc",
  format: "json",
  includeMetadata: true
});

2. API Integration

// Integrate with your existing tools
const replay = await client.getSessionReplay({
  sessionId: "session_123abc"
});

// Send to your analytics platform
await analytics.track("session_analyzed", {
  session_id: replay.id,
  duration: replay.duration,
  decision_count: replay.events.length,
  outcome: replay.outcome
});

Next Steps


Memory Replay is most valuable when used regularly as part of your development and optimization process. Set up recurring reviews to continuously improve your agents.
I