Runner
Run a waldiez flow.
The flow is first converted to an ag2 flow with agents, chats, and tools. We then chown to temporary directory, import and call the flow's main(on_event)
method. The on_event
method is called with the event emitter, which emits events during the flow execution. The flow is run in a temporary directory, and the results are saved to the output file's directory. The uploads root directory is used to store any uploaded files during the flow execution.
WaldiezRunner ¶
WaldiezRunner(
waldiez: Waldiez,
mode: Literal["standard", "debug"] = "standard",
output_path: str | Path | None = None,
uploads_root: str | Path | None = None,
structured_io: bool = False,
dot_env: str | Path | None = None,
**kwargs: Any
)
Bases: WaldiezBaseRunner
Factory class for creating Waldiez runners.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
waldiez | Waldiez | The waldiez flow to run. | required |
mode | Literal['standard', 'debug'] | Runner mode: "standard", "debug", by default "standard" | 'standard' |
output_path | str | Path | None | Output path for results, by default None | None |
uploads_root | str | Path | None | Uploads root directory, by default None | None |
structured_io | bool | Use structured I/O, by default False | False |
dot_env | str | Path | None | Path to a .env file for environment variables, by default None | None |
**kwargs | Any | Additional arguments for specific runner types | {} |
Source code in waldiez/runner.py
load classmethod
¶
load(
waldiez_file: str | Path,
name: str | None = None,
description: str | None = None,
tags: list[str] | None = None,
requirements: list[str] | None = None,
output_path: str | Path | None = None,
uploads_root: str | Path | None = None,
structured_io: bool = False,
dot_env: str | Path | None = None,
**kwargs: Any
) -> WaldiezRunner
Load a waldiez flow and create a runner.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
waldiez_file | str | Path | Path to the waldiez flow file. | required |
name | str | None | Name of the flow, by default None | None |
description | str | None | Description of the flow, by default None | None |
tags | list[str] | None | Tags for the flow, by default None | None |
requirements | list[str] | None | Requirements for the flow, by default None | None |
output_path | str | Path | None | Output path for results, by default None | None |
uploads_root | str | Path | None | Uploads root directory, by default None | None |
structured_io | bool | Use structured I/O, by default False | False |
dot_env | str | Path | None | Path to a .env file for environment variables, by default None | None |
**kwargs | Any | Additional arguments for specific runner types | {} |
Returns:
Type | Description |
---|---|
WaldiezRunner | The configured runner instance |
Source code in waldiez/runner.py
create_runner ¶
create_runner(
waldiez: Waldiez,
mode: Literal[
"standard", "debug", "subprocess"
] = "standard",
output_path: str | Path | None = None,
uploads_root: str | Path | None = None,
structured_io: bool = False,
dot_env: str | Path | None = None,
**kwargs: Any
) -> WaldiezBaseRunner
Create a Waldiez runner of the specified type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
waldiez | Waldiez | The waldiez flow to run. | required |
mode | Literal['standard', 'debug'] | Runner mode: "standard", "debug", by default "standard" | 'standard' |
output_path | str | Path | None | Output path for results, by default None | None |
uploads_root | str | Path | None | Uploads root directory, by default None | None |
structured_io | bool | Use structured I/O, by default False | False |
dot_env | str | Path | None | Path to a .env file for environment variables, by default None | None |
**kwargs | Any | Additional arguments for specific runner types | {} |
Returns:
Type | Description |
---|---|
WaldiezBaseRunner | The configured runner instance |
Raises:
Type | Description |
---|---|
ValueError | If unknown runner mode is specified |