Hello World
The smallest complete Flux program — one task, one workflow.
The smallest complete Flux program: a single @task called from a single
@workflow. Start here to see the shape every Flux program shares — tasks do
the work, the workflow orchestrates them, and ExecutionContext carries the
input. Reach for this pattern when you want a runnable baseline before adding
retries, parallelism, or persistence.
Run it
python examples/hello_world.py
from __future__ import annotations
from flux import ExecutionContext
from flux.task import task
from flux.workflow import workflow
@task
async def say_hello(name: str):
return f"Hello, {name}"
@workflow
async def hello_world(ctx: ExecutionContext[str]):
if not ctx.input:
raise TypeError("Input not provided")
return await say_hello(ctx.input)
if __name__ == "__main__": # pragma: no cover
ctx = hello_world.run("Joe")
print(ctx.to_json())
See also
Last verified against Flux 0.56.0.