ant_ai.workflow.visualize
build_workflow_graph
build_workflow_graph(
workflow: Workflow,
*,
engine: str = "dot",
rankdir: str = "LR",
) -> Digraph
Build and return a graphviz.Digraph for workflow.
The returned object renders inline in Jupyter notebooks and can be passed
to :func:render_workflow for file export.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workflow
|
Workflow
|
The workflow to visualise. |
required |
engine
|
str
|
Graphviz layout engine ( |
'dot'
|
rankdir
|
str
|
Layout direction — |
'LR'
|
Raises:
| Type | Description |
|---|---|
ImportError
|
if the |
Source code in src/ant_ai/workflow/visualize.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | |
render_workflow
render_workflow(
workflow: Workflow,
path: str | Path,
format: Literal[
"png", "jpg", "pdf", "svg", "latex"
] = "png",
*,
engine: str = "dot",
rankdir: str = "LR",
) -> Path
Render workflow to a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workflow
|
Workflow
|
The workflow to visualise. |
required |
path
|
str | Path
|
Output path. The file extension is set automatically based on format (any existing extension is replaced). |
required |
format
|
Literal['png', 'jpg', 'pdf', 'svg', 'latex']
|
|
'png'
|
engine
|
str
|
Graphviz layout engine. |
'dot'
|
rankdir
|
str
|
Layout direction — |
'LR'
|
Returns:
| Type | Description |
|---|---|
Path
|
class: |
Raises:
| Type | Description |
|---|---|
ImportError
|
if the |
ValueError
|
if format is not one of the supported values. |
Source code in src/ant_ai/workflow/visualize.py
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | |