From 098d6193acb9acdfe35862aba6bbb0a4f6576db3 Mon Sep 17 00:00:00 2001 From: Moshi Wei Date: Wed, 23 Jul 2025 19:33:51 +0800 Subject: [PATCH] quick and easy visualization of Agent flow using mermaid this one-liner shows how to create a mermaid visualization of the workflow for beginner to start learning. --- mermaid_graph_plot.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 mermaid_graph_plot.py diff --git a/mermaid_graph_plot.py b/mermaid_graph_plot.py new file mode 100644 index 00000000..f2d2c56d --- /dev/null +++ b/mermaid_graph_plot.py @@ -0,0 +1,16 @@ + +from tradingagents.graph.trading_graph import TradingAgentsGraph +from tradingagents.default_config import DEFAULT_CONFIG +from dotenv import load_dotenv +load_dotenv() + +# Create a custom config +config = DEFAULT_CONFIG.copy() +config["deep_think_llm"] = "gpt-4.1-nano" # Use a different model +config["quick_think_llm"] = "gpt-4.1-nano" # Use a different model +config["max_debate_rounds"] = 1 # Increase debate rounds +config["online_tools"] = True # Use online tools or cached data + +# Initialize with custom config +ta = TradingAgentsGraph(debug=True, config=config) +print(ta.graph.get_graph().draw_mermaid()) \ No newline at end of file