Visualization
get_main_graph
get_main_graph(agent: Agent) -> str
Generates the main graph structure in DOT format for the given agent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent
|
Agent
|
The agent for which the graph is to be generated. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The DOT format string representing the graph. |
Source code in src/agents/extensions/visualization.py
get_all_nodes
Recursively generates the nodes for the given agent and its handoffs in DOT format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent
|
Agent
|
The agent for which the nodes are to be generated. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The DOT format string representing the nodes. |
Source code in src/agents/extensions/visualization.py
get_all_edges
Recursively generates the edges for the given agent and its handoffs in DOT format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent
|
Agent
|
The agent for which the edges are to be generated. |
required |
parent
|
Agent
|
The parent agent. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The DOT format string representing the edges. |
Source code in src/agents/extensions/visualization.py
draw_graph
draw_graph(
agent: Agent, filename: str | None = None
) -> Source
Draws the graph for the given agent and optionally saves it as a PNG file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent
|
Agent
|
The agent for which the graph is to be drawn. |
required |
filename
|
str
|
The name of the file to save the graph as a PNG. |
None
|
Returns:
| Type | Description |
|---|---|
Source
|
graphviz.Source: The graphviz Source object representing the graph. |