Rewind in Agent
Branch conversations and rewind Agent memory to any previous point using the enhanced tracing and context system.
The rewind feature allows you to go back to any point in a conversation and explore different paths. This creates branching conversations where you can test alternative responses or recover from errors.
How It Works
Every agent interaction creates a RunContext with a unique run_id
. The framework automatically traces each step, allowing you to reference any previous point in the conversation.
Creating Branches
You can create new branches by setting RunContext(parent_id=...)
to rewind to any previous point. The agent will only remember the conversation up to that specific point, ignoring everything that happened after.
Example
This creates a branching structure:
Use Cases
- Testing: Try different conversation paths
- Error Recovery: Go back before an error occurred
- Exploration: Explore "what if" scenarios
- A/B Testing: Compare different response strategies
- Debugging: Isolate specific conversation states
Rewind gives you full control over conversation flow and memory management.