Skip to main content
This example is available on GitHub: examples/01_standalone_sdk/26_custom_visualizer.py
The SDK provides flexible visualization options. You can use the default rich-formatted visualizer, customize it with highlighting patterns, or build completely custom visualizers by subclassing ConversationVisualizerBase.

Basic Example

examples/01_standalone_sdk/26_custom_visualizer.py
Running the Example

Visualizer Configuration Options

The visualizer parameter in Conversation controls how events are displayed:

Customizing the Default Visualizer

DefaultConversationVisualizer uses Rich panels and supports customization through configuration:
When to use: Perfect for customizing colors and highlighting without changing the panel-based layout.

Creating Custom Visualizers

For complete control over visualization, subclass ConversationVisualizerBase:

Key Methods

__init__(self, name: str | None = None)
  • Initialize your visualizer with optional configuration
  • name parameter 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 Conversation after 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_stats property
When to use: When you need a completely different output format, custom state tracking, or integration with external systems.

Next Steps

Now that you understand custom visualizers, explore these related topics: