The Workflows module provides standalone task orchestration and automation. You can use this capability independently to build ETL pipelines, run scheduled jobs, trigger background tasks, and manage long-running tasks without requiring other MooseStack components like databases or streams.
Ensure your Workflow and Task is correctly imported into your main.py file.
Example (TypeScript equivalent): export { myworkflow, task1, task2 }
Learn more about export pattern: local development / hosted.
from moose_lib import Task, TaskConfig, TaskContext, Workflow, WorkflowConfigfrom pydantic import BaseModel class Foo(BaseModel): name: str class Bar(BaseModel): name: str greeting: str counter: int def run_task1(ctx: TaskContext[Foo]) -> Bar: greeting = f"hello, {ctx.input.name}!" return Bar( name=ctx.input.name, greeting=greeting, counter=1 ) def run_task2(ctx: TaskContext[Bar]) -> None: print(f"{ctx.input.greeting} (count: {ctx.input.counter})") task1 = Task[Foo, Bar]( name="task1", config=TaskConfig(run=run_task1, on_complete=[task2])) task2 = Task[Bar, None]( name="task2", config=TaskConfig(run=run_task2)) myworkflow = Workflow( name="myworkflow", config=WorkflowConfig(starting_task=task1)) # No export needed - Python modules are automatically discoveredTo enable workflows, you need to add the workflows feature to your moose.config.toml file:
[features]workflows = trueWhile the Workflows capability works independently, it is designed to be used in conjunction with other MooseStack capabilities: