Skip to main content
A ready-to-run example is available here!
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.

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.

Ready-to-run Example

This example is available on GitHub: examples/01_standalone_sdk/26_custom_visualizer.py
examples/01_standalone_sdk/26_custom_visualizer.py
You can run the example code as-is.
The model name should follow the LiteLLM convention: provider/model_name (e.g., anthropic/claude-sonnet-4-5-20250929, openai/gpt-4o). The LLM_API_KEY should be the API key for your chosen provider.
ChatGPT Plus/Pro subscribers: You can use LLM.subscription_login() to authenticate with your ChatGPT account and access Codex models without consuming API credits. See the LLM Subscriptions guide for details.

Next Steps

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