Skip to main content

A workflow engine to run AI applications with event-driven, stepwise control.

Project description

NovaStack Workflows

PyPI - Version Hatch project Testing Ruff Pepy Total Downloads PyPI - License

A powerful and flexible event-driven workflow engine for Python, designed to build complex asynchronous workflows with ease.

Installation

pip install novastack-workflows

Quick Start

Here's a simple example to get you started with NovaStack Workflows:

from novastack.workflows import Workflow, Context, step
from novastack.workflows.events import Event, StartEvent, StopEvent


class MyEvent(Event):
    message: str

class SimpleWorkflow(Workflow):

    @step(depends_on=StartEvent)
    async def start(self, ctx: Context, ev: StartEvent) -> MyEvent:
        
        input_msg = ev.get("input_msg", "")
        
        return MyEvent(message=f"Processed: {input_msg}")

    @step(depends_on=MyEvent)
    async def process(self, ctx: Context, ev: MyEvent) -> StopEvent:
        
        return StopEvent(result=ev.message)


async def main():
    workflow = SimpleWorkflow()
    result = await workflow.run(input_msg="Hello, World!")

    print(result)

Features

Feature NovaStack Workflows
Single-event input
Fan-out (parallelism)
Async execution
Event queue
State (ctx.state)
Single execution (join)
Internal buffer
Declarative

Core Concepts

Workflow

A workflow is a class that inherits from Workflow and contains one or more steps. It orchestrates the execution of steps based on events.

Steps

Steps are methods decorated with @step(depends_on=EventType) that define what happens when a specific event is received.

  • Steps are asynchronous functions that receive a Context and an Event
  • Steps can return new events to trigger subsequent steps

Events

Events are the building blocks of workflows. They carry data between steps and trigger step execution.

  • StartEvent: Automatically triggered when a workflow starts
  • StopEvent: Signals the end of a workflow and carries the final result
  • Custom Events: Define your own events by inheriting from Event

Context

The Context object provides access to workflow state and allows steps to share data throughout the workflow execution.

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

novastack_workflows-1.1.0.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

novastack_workflows-1.1.0-py3-none-any.whl (26.3 kB view details)

Uploaded Python 3

File details

Details for the file novastack_workflows-1.1.0.tar.gz.

File metadata

  • Download URL: novastack_workflows-1.1.0.tar.gz
  • Upload date:
  • Size: 20.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for novastack_workflows-1.1.0.tar.gz
Algorithm Hash digest
SHA256 a0d2fb7a54cd079bb3d816648ebe339f90542d4657dbbe213c6980933feb33cf
MD5 f85ad46533f8cbb9d19cf97f7c22dc16
BLAKE2b-256 db84f10de801351ec2d03a1ad20221f6b947776806f9ecbc68a2137dc8c8d43e

See more details on using hashes here.

File details

Details for the file novastack_workflows-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for novastack_workflows-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1ece9e9771251bdd7cadeb3c5152a523dc133c74ad8f3738817139eda6e2ebff
MD5 dbb6be1926ae74ae857784fa0ffb025b
BLAKE2b-256 ce6a2ee37b393433106822bfb6203e442d0248b4fc36ed7183a190492bd3d6dd

See more details on using hashes here.

Supported by

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