Skip to main content

Hello World

Let's create your first Graflow workflow.

Install Graflow

pip install graflow

Your First Task

Create a file called hello.py:

from graflow import task

@task
def hello():
print("Hello, Graflow!")
return "success"

if __name__ == "__main__":
result = hello.run()
print(f"Task completed with result: {result}")

Run it:

python hello.py

You should see:

Hello, Graflow!
Task completed with result: success

Your First Workflow

Now let's chain multiple tasks into a workflow. Create pipeline.py:

from graflow import task, workflow

with workflow("simple_pipeline") as wf:

@task
def start():
print("Starting!")

@task
def middle():
print("Middle!")

@task
def end():
print("End!")

# Define sequential pipeline: start -> middle -> end
start >> middle >> end

# Execute the workflow
wf.execute()

Run it:

python pipeline.py

You should see:

Starting!
Middle!
End!

The >> operator chains tasks sequentially — middle runs after start, and end runs after middle.

Next Steps

Congratulations! You've run your first Graflow workflow. Continue to the Tutorial to learn more advanced features.