From 2ba69a3275dd0d296a596c36c803b75072fc1dda Mon Sep 17 00:00:00 2001 From: comp <323443+comp@users.noreply.github.com> Date: Mon, 6 Jul 2026 21:09:42 -0600 Subject: [PATCH] fix(visualization): keep fillcolor on handoff nodes by merging style attributes --- src/agents/extensions/visualization.py | 4 ++-- tests/test_visualization.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/agents/extensions/visualization.py b/src/agents/extensions/visualization.py index 75dcc7bc21..6ae61774a4 100644 --- a/src/agents/extensions/visualization.py +++ b/src/agents/extensions/visualization.py @@ -97,7 +97,7 @@ def get_all_nodes( name = _escape_label(handoff.agent_name) parts.append( f'"{name}" [label="{name}", ' - f"shape=box, style=filled, style=rounded, " + f'shape=box, style="filled,rounded", ' f"fillcolor=lightyellow, width=1.5, height=0.8];" ) if isinstance(handoff, Agent): @@ -105,7 +105,7 @@ def get_all_nodes( name = _escape_label(handoff.name) parts.append( f'"{name}" [label="{name}", ' - f"shape=box, style=filled, style=rounded, " + f'shape=box, style="filled,rounded", ' f"fillcolor=lightyellow, width=1.5, height=0.8];" ) parts.append(get_all_nodes(handoff, agent, visited)) diff --git a/tests/test_visualization.py b/tests/test_visualization.py index 10a26ab306..b6eb1c6f71 100644 --- a/tests/test_visualization.py +++ b/tests/test_visualization.py @@ -64,7 +64,7 @@ def test_get_main_graph(mock_agent): "fillcolor=lightgreen, width=0.5, height=0.3];" in result ) assert ( - '"Handoff1" [label="Handoff1", shape=box, style=filled, style=rounded, ' + '"Handoff1" [label="Handoff1", shape=box, style="filled,rounded", ' "fillcolor=lightyellow, width=1.5, height=0.8];" in result ) _assert_mcp_nodes(result) @@ -93,7 +93,7 @@ def test_get_all_nodes(mock_agent): "fillcolor=lightgreen, width=0.5, height=0.3];" in result ) assert ( - '"Handoff1" [label="Handoff1", shape=box, style=filled, style=rounded, ' + '"Handoff1" [label="Handoff1", shape=box, style="filled,rounded", ' "fillcolor=lightyellow, width=1.5, height=0.8];" in result ) _assert_mcp_nodes(result) @@ -139,7 +139,7 @@ def test_draw_graph(mock_agent): "fillcolor=lightgreen, width=0.5, height=0.3];" in graph.source ) assert ( - '"Handoff1" [label="Handoff1", shape=box, style=filled, style=rounded, ' + '"Handoff1" [label="Handoff1", shape=box, style="filled,rounded", ' "fillcolor=lightyellow, width=1.5, height=0.8];" in graph.source ) _assert_mcp_nodes(graph.source) @@ -270,7 +270,7 @@ def test_draw_graph_with_real_handoff_object(): assert '"ParentAgent"' in graph.source # Node uses agent_name from the Handoff object assert ( - '"ChildAgent" [label="ChildAgent", shape=box, style=filled, style=rounded, ' + '"ChildAgent" [label="ChildAgent", shape=box, style="filled,rounded", ' "fillcolor=lightyellow, width=1.5, height=0.8];" in graph.source ) # Edge points from parent to handoff agent_name