Pathways.visualize()
Create an HTML visualization of this pathway and save to file.
Usage
Pathways.visualize(
title=None,
filename=None,
auto_open=True,
)This method generates a flowchart diagram showing all states, transitions, and branching logic using pure HTML/CSS. The visualization includes:
- color-coded boxes based on state type (collect, tool, decision, summary)
- clear flow arrows showing progression
- reconvergence indicators for states with multiple parents
- professional styling with hover effects
Parameters
title: str = None-
Title for the visualization page. If
None, uses the pathway title. filename: str = None-
Name for the HTML file (without extension). If
None, uses “pathway_visualization”. auto_open: bool = True- Whether to automatically open the visualization in the default browser.
Returns
str- Path to the generated HTML file
Examples
Create and display a pathway visualization:
import talk_box as tb
# Create a pathway
pathway = (
tb.Pathways(
title="Customer Support",
desc="Handle customer inquiries efficiently"
)
.state("intake: gather customer information")
.next_state("triage")
.state("triage: determine support type")
.branch_on("Technical issue", id="tech_support")
.branch_on("Billing question", id="billing")
.state("tech_support: resolve technical problems")
.tools(["diagnostic_tool"])
.next_state("completion")
.state("billing: handle billing inquiries")
.next_state("completion")
.state("completion: wrap up and follow up", type="summary")
)
# Generate and open visualization
pathway.visualize() # Opens in browser automatically
# Save to specific file without opening
pathway.visualize(filename="my_pathway", auto_open=False)