Create interactive HTML visualizations and get ReactFlow-compatible data
visualize()
get_agency_structure()
def visualize( self, output_file: str = "agency_visualization.html", include_tools: bool = True, open_browser: bool = True ) -> str
output_file
str
"agency_visualization.html"
include_tools
bool
True
open_browser
from agency_swarm import Agency, Agent, function_tool @function_tool def analyze_data(data: str) -> str: """Analyze data""" return f"Analysis: {data}" analyst = Agent( name="Analyst", instructions="You analyze data.", tools=[analyze_data] ) manager = Agent( name="Manager", instructions="You coordinate work." ) agency = Agency( manager, communication_flows=[(manager, analyst)], name="Analysis Agency" ) # Create visualization html_file = agency.visualize() print(f"Saved to: {html_file}")