Replay Platform
The Replay Platform is Layerrs observability layer. Every request that passes through the system leaves a complete trace, not just the request and response, but the full routing decision, the candidates that were considered, the scores they received, and the rationale for the choice.
Key Files
Section titled “Key Files”| File | Purpose |
|---|---|
replay/comparator.ts | Compares two traces side-by-side |
replay/analysis.ts | Analyses trace patterns and trends |
replay/types.ts | Core replay types |
storage/replay.ts | Persistence layer for traces |
explainability/explainer.ts | Builds human-readable explanations |
src/features/replay/DecisionBreakdownPanel.tsx | UI for decision breakdown |
src/features/replay/OrchestrationReplayStudio.tsx | Replay studio interface |
src/traces/TracesPage.tsx | Main traces listing page |
What Gets Recorded
Section titled “What Gets Recorded”Every trace contains:
- Request: Full prompt, metadata, detected workload
- Routing decision: Chosen provider, model, strategy
- Candidate list: All providers considered, with scores
- Fallback chain: Ordered list of fallbacks
- Execution: Latency, token usage, actual cost
- Outcome: Quality score, user feedback (if any)
- Explanation: Structured rationale for the decision
Trace Comparison
Section titled “Trace Comparison”compareTraces takes two trace IDs and produces:
- Score delta: How the two decisions differed in quality/cost
- Adaptive promotion: Whether the cheaper option was good enough to promote
- Numeric direction: Whether the system trended toward better or worse
- Reason count: Breakdown of why differences occurred
Decision Breakdown
Section titled “Decision Breakdown”The DecisionBreakdownPanel renders a step-by-step explanation:
- What was detected about the workload
- Which strategy was chosen and why
- How each candidate was scored
- Why the winner was picked
- What the fallback chain looked like
- How much was saved (or spent extra) vs baseline
Replay Studio
Section titled “Replay Studio”The OrchestrationReplayStudio lets you:
- Replay any historical request with a different strategy
- Compare outcomes across strategies
- See what would have happened with a different provider
- Export replay data for external analysis
Storage
Section titled “Storage”storage/replay.ts handles:
listRecentTraces: Recent traces with filteringanalyzeRecentTraces: Aggregate analysis over a time window- TTL-based cleanup for old traces
- Export to external observability systems