WaldiezRunner
Run a waldiez flow. The flow is first converted to an autogen flow with agents, chats and skills. We then chown to temporary directory, call the flow's main()
and return the results. Before running the flow, any additional environment variables specified in the waldiez file are set.
WaldiezRunner(waldiez: Waldiez, file_path: Optional[Union[str, Path]] = None)
¶
Waldiez runner class.Source code in
waldiez/runner.py
a_install_requirements() -> None
async
¶
Install the requirements for the flow asynchronously.Source code in
waldiez/runner.py
a_run(output_path: Optional[Union[str, Path]] = None, uploads_root: Optional[Union[str, Path]] = None) -> Union[ChatResult, List[ChatResult]]
async
¶
Run the Waldiez workflow asynchronously.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
output_path | Optional[Union[str, Path]] | The output path, by default None. | None |
uploads_root | Optional[Union[str, Path]] | The uploads root, to get user-uploaded files, by default None. | None |
Returns:
Type | Description |
---|---|
Union[ChatResult, List[ChatResult]] | The result(s) of the chat(s). |
Raises:
Type | Description |
---|---|
RuntimeError | If the workflow is already running. |
Source code in waldiez/runner.py
gather_requirements() -> Set[str]
¶
Gather extra requirements to install before running the flow.
Returns:
Type | Description |
---|---|
Set[str] | The extra requirements. |
Source code in waldiez/runner.py
install_requirements() -> None
¶
Install the requirements for the flow.Source code in
waldiez/runner.py
load(waldiez_file: Union[str, Path], name: Optional[str] = None, description: Optional[str] = None, tags: Optional[List[str]] = None, requirements: Optional[List[str]] = None) -> WaldiezRunner
classmethod
¶
Create a WaldiezRunner instance from a file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
waldiez_file | Union[str, Path] | The file path. | required |
name | Optional[str] | The name of the Waldiez, by default None. | None |
description | Optional[str] | The description of the Waldiez, by default None. | None |
tags | Optional[List[str]] | The tags of the Waldiez, by default None. | None |
requirements | Optional[List[str]] | The requirements of the Waldiez, by default None. | None |
Returns:
Type | Description |
---|---|
WaldiezRunner | The Waldiez runner instance. |
Raises:
Type | Description |
---|---|
FileNotFoundError | If the file is not found. |
RuntimeError | If the file is not a valid Waldiez file. |
Source code in waldiez/runner.py
run(output_path: Optional[Union[str, Path]] = None, uploads_root: Optional[Union[str, Path]] = None, skip_mmd: bool = False) -> Union[ChatResult, List[ChatResult]]
¶
Run the Waldiez workflow.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
output_path | Optional[Union[str, Path]] | The output path, by default None. | None |
uploads_root | Optional[Union[str, Path]] | The uploads root, to get user-uploaded files, by default None. | None |
skip_mmd | bool | Whether to skip the Mermaid diagram generation, by default False. | False |
Returns:
Type | Description |
---|---|
Union[ChatResult, List[ChatResult]] | The result(s) of the chat(s). |
Raises:
Type | Description |
---|---|
RuntimeError | If the workflow is already running. |
Source code in waldiez/runner.py
running: bool
property
¶
Get the running status.
waldiez: Waldiez
property
¶
Get the Waldiez instance.