waldiez
Project description
Waldiez
Translate a Waldiez flow:
To a python script or a jupyter notebook with the corresponding autogen agents and chats.
Features
- Export .waldiez flows to .py or .ipynb
- Run a .waldiez flow
- Include a
logs
folder with the logs of the flow in csv format - Provide a custom IOSStream to handle input and output.
Installation
On PyPI:
python -m pip install waldiez
From the repository:
python -m pip install git+https://github.com/waldiez/py.git
Usage
CLI
# Export a Waldiez flow to a python script or a jupyter notebook
waldiez --export /path/to/a/flow.waldiez --output /path/to/an/output/flow[.py|.ipynb]
# Export and run the script, optionally force generation if the output file already exists
waldiez /path/to/a/flow.waldiez --output /path/to/an/output/flow[.py] [--force]
Using docker/podman
CONTAINER_COMMAND=docker # or podman
# pull the image
$CONTAINER_COMMAND pull waldiez/py
# Export a Waldiez flow to a python script or a jupyter notebook
$CONTAINER_COMMAND run \
--rm \
-v /path/to/a/flow.waldiez:/flow.waldiez \
-v /path/to/an/output:/output \
waldiez/py --export /flow.waldiez --output /output/flow[.py|.ipynb]
# with selinux and/or podman, you might get permission (or file not found) errors, so you can try:
$CONTAINER_COMMAND run \
--rm \
-v /path/to/a/flow.waldiez:/flow.waldiez \
-v /path/to/an/output:/output \
--userns=keep-id \
--security-opt label=disable \
waldiez/py --export /flow.waldiez --output /output/flow[.py|.ipynb]
# Export and run the script
$CONTAINER_COMMAND run --rm -v /path/to/a/flow.waldiez:/flow.waldiez -v /path/to/an/output:/output waldiez/py /flow.waldiez --output /output/output[.py]
As a library
Export a flow
# Export a Waldiez flow to a python script or a jupyter notebook
from waldiez import WaldiezExporter
flow_path = "/path/to/a/flow.waldiez"
output_path = "/path/to/an/output.py" # or .ipynb
exporter = WaldiezExporter.load(flow_path)
exporter.export(output_path)
Run a flow
# Run a flow
from waldiez import WaldiezRunner
flow_path = "/path/to/a/flow.waldiez"
output_path = "/path/to/an/output.py"
runner = WaldiezRunner.load(flow_path)
runner.run(output_path=output_path)
Run a flow with a custom IOStream
# Run the flow with a custom IOStream
from waldiez import WaldiezRunner
from waldiez.io import WaldiezIOStream
flow_path = "/path/to/a/flow.waldiez"
output_path = "/path/to/an/output.py"
def print_function(*values, **args) -> None:
"""A custom print function."""
print(values)
def on_prompt_input(prompt: str) -> str:
"""A custom input function."""
return input(prompt)
io_stream = WaldiezIOStream(
print_function=print_function,
on_prompt_input=on_prompt_input,
input_timeout=30,
)
with WaldiezIOStream.set_default(io_stream):
runner = WaldiezRunner.load(flow_path)
runner.run(stream=io_stream, output_path=output_path)
io_stream.close()
Tools
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
waldiez-0.1.7.tar.gz
(64.9 kB
view details)
Built Distribution
waldiez-0.1.7-py3-none-any.whl
(103.1 kB
view details)
File details
Details for the file waldiez-0.1.7.tar.gz
.
File metadata
- Download URL: waldiez-0.1.7.tar.gz
- Upload date:
- Size: 64.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 971e20aadc3cf4f0e75b51a1e67cbc9819d5cca7c9c50d775c412cea9c558e6c |
|
MD5 | 8b669f06be9ffff84c91d87176008b48 |
|
BLAKE2b-256 | 17b547f1defae08082d5a0c0d9c591fddc920caf4079419a3f1bd36311f75395 |
Provenance
The following attestation bundles were made for waldiez-0.1.7.tar.gz
:
Publisher:
release.yaml
on waldiez/py
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
waldiez-0.1.7.tar.gz
- Subject digest:
971e20aadc3cf4f0e75b51a1e67cbc9819d5cca7c9c50d775c412cea9c558e6c
- Sigstore transparency entry: 146775600
- Sigstore integration time:
- Predicate type:
File details
Details for the file waldiez-0.1.7-py3-none-any.whl
.
File metadata
- Download URL: waldiez-0.1.7-py3-none-any.whl
- Upload date:
- Size: 103.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3513b56213ac8f59e82623e5b941ecb338fa7bac23369cadd3902b04323c4f7d |
|
MD5 | fa1eeb9c2419804626ab4339c2ef4487 |
|
BLAKE2b-256 | 5ce42768ebb05b22eb9b29e1bb5ec58719d8b251dbbd6ae5b4726cdf202cadff |
Provenance
The following attestation bundles were made for waldiez-0.1.7-py3-none-any.whl
:
Publisher:
release.yaml
on waldiez/py
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
waldiez-0.1.7-py3-none-any.whl
- Subject digest:
3513b56213ac8f59e82623e5b941ecb338fa7bac23369cadd3902b04323c4f7d
- Sigstore transparency entry: 146775604
- Sigstore integration time:
- Predicate type: