Quickstart
Run a Flux server, register a workflow, and execute it — in five minutes.
Go from “Flux is installed” to “I ran my first workflow and saw the result” in five minutes. You’ll register a workflow with the Flux server, execute it, and inspect the result.
-
Write a workflow
Create
hello.py:from flux import ExecutionContext from flux.task import task from flux.workflow import workflow @task async def say_hello(name: str) -> 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())Two decorators: one task, one workflow. The
@workflow-decorated function receives anExecutionContextwith whatever input you pass to.run(). -
Run it directly
python hello.pyYou should see JSON output containing
"output": "Hello, Joe"plus the workflow’s execution metadata (event log, timestamps, status).That ran the workflow in-process. Flux recorded the execution to a
.flux/directory in your current working directory (auto-created on first run). No server, no worker, no networking. Useful for development; not how you’d run it in production. -
Start the Flux server
Open a new terminal:
flux start serverThe server listens on
http://localhost:8000and exposes a REST API plus thefluxCLI’s transport. Leave this running; it blocks the terminal. -
Start a worker
Workers are separate processes that pick up queued executions and run them, authenticating to the server with a bootstrap token.
flux start serverblocks its terminal, so open a second terminal and fetch a token from there:flux server bootstrap-tokenCopy the token. In the same second terminal, start a worker with it:
export FLUX_WORKERS__BOOTSTRAP_TOKEN="<paste-token-here>" flux start worker my-workerflux start workeralso blocks. Without a worker,flux workflow runwill queue executions but they’ll sit inCREATEDstate forever. -
Register and run via the CLI
Open a third terminal (or background the worker and reuse the second one), then go to the directory containing
hello.py:flux workflow register hello.py flux workflow run hello_world '"Joe"'The first command registers the workflow with the server. The second invokes it. Input is a positional argument, JSON-encoded — a string is
'"Joe"', a dict would be'{"key":"value"}'.You’ll see a JSON response with
workflow_id,execution_id, and the initial state (CREATEDorSCHEDULED). The worker picks it up within a second. -
Inspect what happened
flux workflow list flux execution listworkflow listshows registered workflows;execution listshows recent executions with status. To see one execution in detail (use theexecution_idfrom the previous step):flux execution show <execution-id> --detailedThis prints the full event log — every task call, its input, its output, its timestamps.
What just happened
Flux recorded every step (the task call, its input, its output) to a durable event log. If your process had crashed mid-run, you could replay from the last completed task. That’s the whole pitch.
Next
- Your first workflow — write a more interesting workflow with composition and parallelism
- Your first agent — build an LLM agent with tools
- Why Flux — read the design philosophy if you skipped it