A workflow engine to run AI applications with event-driven, stepwise control.
Project description
NovaStack Workflows
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, Event, StartEvent, StopEvent
# Define a custom event
class MyEvent(Event):
message: str
# Create your workflow
class SimpleWorkflow(Workflow):
"""A simple workflow that processes a message."""
@step(on=StartEvent)
async def start(self, ctx: Context, ev: StartEvent) -> MyEvent:
# Get input from the start event
input_msg = ev.get("input_msg", "")
# Return a custom event to trigger the next step
return MyEvent(message=f"Processed: {input_msg}")
@step(on=MyEvent)
async def process(self, ctx: Context, ev: MyEvent) -> StopEvent:
# Process the message and return the final result
return StopEvent(result=ev.message)
# Run the workflow
async def main():
workflow = SimpleWorkflow()
result = await workflow.run(input_msg="Hello, World!")
print(result)
Core Concepts
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
Steps
Steps are methods decorated with @step(on=EventType) that define what happens when a specific event is received.
- Steps are asynchronous functions that receive a
Contextand anEvent - Steps can return new events to trigger subsequent steps
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.
Context
The Context object provides access to workflow state and allows steps to share data throughout the workflow execution.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file novastack_workflows-1.0.0.tar.gz.
File metadata
- Download URL: novastack_workflows-1.0.0.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.16.5 cpython/3.11.9 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e90296d75067647b1e636fc2bf507b68f188fb67c01d20076d697e0fdfec1884
|
|
| MD5 |
95772891f32e757c3f7dcb8549ebd3ce
|
|
| BLAKE2b-256 |
688d1caa18c034d1a0f021cc0a02fca82b74e256f3d8c49935c3623d516c3957
|
File details
Details for the file novastack_workflows-1.0.0-py3-none-any.whl.
File metadata
- Download URL: novastack_workflows-1.0.0-py3-none-any.whl
- Upload date:
- Size: 16.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.16.5 cpython/3.11.9 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aad4f7dd7cc48dfbb57f64b75f0ba79d4d485ac4e5084642f9d4ba052c884c9a
|
|
| MD5 |
3df8b1616382f2d3fa436c9d0e6be172
|
|
| BLAKE2b-256 |
3c0dcf63b42ba1a4db3122e213a596b5ba2c0853c3bccd1b0876b4240f006e71
|