haive.core.graph.state_graph.graph_visualizer¶

Enhanced graph visualization utilities for Haive graphs with automatic Agent detection and expansion.

This module provides comprehensive visualization that automatically detects nodes with Agent engines or nodes that are Agents themselves, expanding them to show their complete internal graph structure.

Classes¶

AgentInfo

Information about a detected agent node.

GraphVisualizer

Enhanced visualization utilities with automatic Agent detection and expansion.

NodeStyle

Standardized node styles for consistent visualization.

VisualizationContext

Context object for tracking visualization state.

Module Contents¶

class haive.core.graph.state_graph.graph_visualizer.AgentInfo¶

Information about a detected agent node.

class haive.core.graph.state_graph.graph_visualizer.GraphVisualizer¶

Enhanced visualization utilities with automatic Agent detection and expansion.

Key features: - Detects nodes that are Agents or contain Agent engines - Recursively expands Agent graphs showing internal structure - Consistent styling with professional color scheme - Smart edge routing between parent and subgraphs - Handles nested agents and complex hierarchies

classmethod debug_graph_structure(graph)¶

Debug helper to analyze graph structure.

Parameters:

graph (Any)

Return type:

dict[str, Any]

classmethod display_graph(graph, output_path=None, include_subgraphs=True, highlight_nodes=None, highlight_paths=None, save_png=False, width='100%', theme='base', subgraph_mode='cluster', show_default_branches=True, direction='TB', compact_mode=False, title=None, debug=False)¶

Generate and display graph with Agent expansion.

Returns:

Generated Mermaid code

Parameters:
  • graph (Any)

  • output_path (str | None)

  • include_subgraphs (bool)

  • highlight_nodes (list[str] | None)

  • highlight_paths (list[list[str]] | None)

  • save_png (bool)

  • width (str)

  • theme (str)

  • subgraph_mode (str)

  • show_default_branches (bool)

  • direction (str)

  • compact_mode (bool)

  • title (str | None)

  • debug (bool)

Return type:

str

classmethod generate_mermaid(graph, include_subgraphs=True, highlight_nodes=None, theme='base', show_branch_labels=True, direction='TB', compact=False, max_depth=3, debug=False)¶

Generate a comprehensive Mermaid diagram with automatic Agent expansion.

Parameters:
  • graph (Any) – The graph to visualize

  • include_subgraphs (bool) – Whether to expand Agent nodes

  • highlight_nodes (list[str] | None) – Nodes to highlight

  • theme (str) – Mermaid theme

  • show_branch_labels (bool) – Whether to show labels on conditional branches

  • direction (str) – Graph direction (TB, LR, etc.)

  • compact (bool) – Use compact layout

  • max_depth (int) – Maximum depth for nested agent expansion

  • debug (bool) – Enable debug output

Returns:

Complete Mermaid diagram string

Return type:

str

class haive.core.graph.state_graph.graph_visualizer.NodeStyle(*args, **kwds)¶

Bases: enum.Enum

Standardized node styles for consistent visualization.

class haive.core.graph.state_graph.graph_visualizer.VisualizationContext¶

Context object for tracking visualization state.