Skip to main content

waldiez

Project description

Waldiez

CI Build Coverage Status PyPI version

Translate a Waldiez flow:

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[.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[.py] [--force]

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 WaldiezIOStream, WaldiezRunner

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


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.5.tar.gz (64.0 kB view details)

Uploaded Source

Built Distribution

waldiez-0.1.5-py3-none-any.whl (102.2 kB view details)

Uploaded Python 3

File details

Details for the file waldiez-0.1.5.tar.gz.

File metadata

  • Download URL: waldiez-0.1.5.tar.gz
  • Upload date:
  • Size: 64.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for waldiez-0.1.5.tar.gz
Algorithm Hash digest
SHA256 914fc36f9cd464d552e6210e6e7fb47e77e6513e300de8248a6a665a4fae16e2
MD5 3a29ab91cf8fd16ca5c451bae11bf06c
BLAKE2b-256 7cd53cd8453b063604e7533f0f59fdc63383629ea5db90c8e5baad6014c0f45f

See more details on using hashes here.

File details

Details for the file waldiez-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: waldiez-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 102.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for waldiez-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5b581b6ecac5ca33173a390a7394cb5a867d205cf102d5eb2c1b5762b21ab9dc
MD5 4251de95bac803099b45c857e964a9bd
BLAKE2b-256 90e6fb8945e4fcf97b4ef7068ccb479de7b8dd1b64d4fbc97d2e145b76434740

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page