Skip to content

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#

ag2 replay                    # List recent sessions
ag2 replay <session_id>       # Replay a specific session

Step-Through Mode#

Walk through a conversation turn by turn, inspecting state at each step:

ag2 replay <session_id> --step

Branching#

Replay from a specific turn with a different message to explore alternative paths:

ag2 replay <session_id> --branch-at 3 --message "Try a different approach"

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:

ag2 replay --compare <session_id_1> <session_id_2>

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