Replay Export
Export a recorded run as self-contained HTML, JSON, Mermaid, or OpenTelemetry OTLP
praisonai replay export turns a recorded run into a file you can share, diff, diagram, or send to any OpenTelemetry backend.
from praisonaiagents import Agent
from praisonai.replay import record, export, load_events
with record() as rec:
Agent(name="writer", instructions="Draft a short blog post").start("AI agents")
with open(f"{rec.run_id}.html", "w", encoding="utf-8") as f:
f.write(export.to_html(load_events(rec.path)))Quick Start
- Export to HTML
bash praisonai replay export run-1a2b3c4d5e6fWrites
./run-1a2b3c4d5e6f.html— open it in any browser, offline. - Pick another format
JSON
bash praisonai replay export run-1a2b3c4d5e6f --format json -o run.jsonMermaid
bash praisonai replay export run-1a2b3c4d5e6f --format mermaid -o run.mmdOTLP
bash praisonai replay export run-1a2b3c4d5e6f --format otel -o run.otlp.json
Formats
--format | Python | Output | Use it to |
|---|---|---|---|
html (default) | to_html(events, *, redact=True, graph=None, title=None) | One self-contained HTML page | Share a run with anyone |
json | to_json(events, *, redact=True, indent=2) | {"schema": "praisonai.replay/1", "run_id", "graph", "events"} | Diff runs or feed other tools |
mermaid | to_mermaid(events, *, redact=True) | Mermaid sequenceDiagram | Paste a diagram into a README or PR |
otel | to_otlp_json(events, *, redact=True, service_name="praisonai") | OTLP/JSON ExportTraceServiceRequest | Load into Jaeger, Tempo, Honeycomb, etc. |
Options
| Option | Default | Description |
|---|---|---|
RUN | — | Run id or path to a trace file |
--format, -f | html | html, json, mermaid, or otel |
--output, -o | stdout (html: ./<run>.html) | Write to a file |
--no-redact | off | Export as recorded, without removing secrets/PII |
Redaction
Every export is redacted by default — secrets are found by key name and secret/PII patterns are scrubbed from free text.
| Data | Result |
|---|---|
Values under secret-looking keys (api_key, token, …) | [REDACTED] |
Numbers under those keys (prompt_tokens, max_tokens) | Kept — they are counters |
| Free text (prompts, outputs) | Secret and PII patterns scrubbed |
Self-Contained HTML
The HTML file has zero external references — no CDN, nothing fetched when it opens — so it works air-gapped.
| You have | The page shows |
|---|---|
praisonai[ui] installed | The full replay timeline, with its renderer inlined |
| No UI installed | A built-in table timeline |
OpenTelemetry (OTLP)
--format otel writes an OTLP/JSON trace using the OpenTelemetry GenAI semantic conventions, with no OpenTelemetry dependency.
praisonai replay export run-1a2b3c4d5e6f --format otel -o run.otlp.json
curl -X POST http://localhost:4318/v1/traces \
-H "Content-Type: application/json" \
--data @run.otlp.json| Span | Covers |
|---|---|
invoke_workflow | The whole run |
invoke_agent | One agent |
chat | One LLM call |
execute_tool | One tool call |
| task / step / approval | Workflow structure |
Attributes include gen_ai.operation.name, gen_ai.agent.name, gen_ai.request.model, and gen_ai.usage.input_tokens. Ids are deterministic, so exporting the same run twice gives the same trace.
Python
import json
from praisonai.replay import export, load_events
events = load_events("run-1a2b3c4d5e6f")
open("run.html", "w", encoding="utf-8").write(export.to_html(events))
open("run.json", "w", encoding="utf-8").write(export.to_json(events))
open("run.mmd", "w", encoding="utf-8").write(export.to_mermaid(events))
open("run.otlp.json", "w", encoding="utf-8").write(json.dumps(export.to_otlp_json(events)))Best Practices
Share HTML, not the server
Send the HTML file instead of exposing replay view on the network.
Use OTLP for long-term storage
Your existing tracing backend already handles retention and search — send it --format otel.