This example is available on GitHub: examples/01_standalone_sdk/26_custom_visualizer.py
ConversationVisualizerBase.
Basic Example
examples/01_standalone_sdk/26_custom_visualizer.py
Running the Example
Visualizer Configuration Options
Thevisualizer parameter in Conversation controls how events are displayed:
Customizing the Default Visualizer
DefaultConversationVisualizer uses Rich panels and supports customization through configuration:
Creating Custom Visualizers
For complete control over visualization, subclassConversationVisualizerBase:
Key Methods
__init__(self, name: str | None = None)
- Initialize your visualizer with optional configuration
nameparameter is available from the base class for agent identification- Call
super().__init__(name=name)to initialize the base class
initialize(self, state: ConversationStateProtocol)
- Called automatically by
Conversationafter state is created - Provides access to conversation state and statistics via
self._state - Override if you need custom initialization, but call
super().initialize(state)
on_event(self, event: Event) (required)
- Called for each conversation event
- Implement your visualization logic here
- Access conversation stats via
self.conversation_statsproperty
Next Steps
Now that you understand custom visualizers, explore these related topics:- Events - Learn more about different event types
- Conversation Metrics - Track LLM usage, costs, and performance data
- Send Messages While Running - Interactive conversations with real-time updates
- Pause and Resume - Control agent execution flow with custom logic

