MCPcopy Index your code
hub / github.com/google/adk-python / draw_node

Function draw_node

src/google/adk/cli/agent_graph.py:218–262  ·  view source on GitHub ↗
(tool_or_agent: Union[BaseAgent, BaseTool])

Source from the content-addressed store, hash-verified

216 )
217
218 async def draw_node(tool_or_agent: Union[BaseAgent, BaseTool]):
219 name = get_node_name(tool_or_agent)
220 shape = get_node_shape(tool_or_agent)
221 caption = get_node_caption(tool_or_agent)
222 as_cluster = should_build_agent_cluster(tool_or_agent)
223 if highlight_pairs:
224 for highlight_tuple in highlight_pairs:
225 if name in highlight_tuple:
226 # if in highlight, draw highlight node
227 if as_cluster:
228 cluster = graphviz.Digraph(
229 name='cluster_' + name
230 ) # adding "cluster_" to the name makes the graph render as a cluster subgraph
231 await build_cluster(cluster, agent, name)
232 graph.subgraph(cluster)
233 else:
234 graph.node(
235 name,
236 caption,
237 style='filled,rounded',
238 fillcolor=dark_green,
239 color=dark_green,
240 shape=shape,
241 fontcolor=light_gray,
242 )
243 return
244 # if not in highlight, draw non-highlight node
245 if as_cluster:
246 cluster = graphviz.Digraph(
247 name='cluster_' + name
248 ) # adding "cluster_" to the name makes the graph render as a cluster subgraph
249 await build_cluster(cluster, agent, name)
250 graph.subgraph(cluster)
251
252 else:
253 graph.node(
254 name,
255 caption,
256 shape=shape,
257 style='rounded',
258 color=light_gray,
259 fontcolor=light_gray,
260 )
261
262 return
263
264 def draw_edge(from_name, to_name):
265 if highlight_pairs:

Callers 1

build_graphFunction · 0.85

Calls 6

get_node_nameFunction · 0.85
get_node_shapeFunction · 0.85
get_node_captionFunction · 0.85
build_clusterFunction · 0.85
nodeMethod · 0.45

Tested by

no test coverage detected