Replay
The ag2 replay command lets you review past agent sessions recorded by ag2 run and ag2 chat.
Sessions are automatically saved to ~/.ag2/sessions/.
Basic Replay#
Step-Through Mode#
Walk through a conversation turn by turn, inspecting state at each step:
Branching#
Replay from a specific turn with a different message to explore alternative paths:
Branched replays use cached LLM responses for turns before the branch point, making them fast and cost-effective.
Comparison#
Compare two sessions side by side, showing differences in turns, cost, time, and tool usage:
Export#
Export a session to different formats:
ag2 replay <session_id> --export markdown
ag2 replay <session_id> --export html
ag2 replay <session_id> --export json
Options#
| Flag | Description |
|---|---|
--step | Interactive step-through mode |
--branch-at | Turn number to branch from |
--message | New message for branched replay |
--compare | Compare two sessions |
--export | Export format: markdown, html, json |