Each page in this section is a short path to your first durable workflow. It runs one sample and stops it in the middle. Then it shows that the workflow continues.
For the full quickstart with all languages, see the Workflow quickstart.
This is the multi-page printable view of this section. Click here to print.
Each page in this section is a short path to your first durable workflow. It runs one sample and stops it in the middle. Then it shows that the workflow continues.
For the full quickstart with all languages, see the Workflow quickstart.
In this quickstart, you run an order workflow, stop the app while the workflow waits, and start the app again. The workflow continues from its history.
A workflow is code that Dapr runs step by step and saves after each step. If the app stops, Dapr runs the workflow again from the saved history. The steps that finished do not run again.
Use a workflow when:
A plain service call is enough when one request does one short job and the caller can retry the whole request.
You need the Dapr CLI and uv. SQLite keeps the workflow state, so you do not need Docker or Redis.
Clone the repository and go to the sample:
git clone https://github.com/dapr/quickstarts.git
cd quickstarts/workflows/python/sdk
Install the Dapr binaries. This does not start them:
dapr init --slim
In a terminal in this directory, start the Scheduler service:
$HOME/.dapr/bin/scheduler --etcd-data-dir ./scheduler-data
In a second terminal in the same directory, start the Placement service:
$HOME/.dapr/bin/placement --healthz-port 8081 --metrics-port 9091
In a third terminal in the same directory, install the dependencies:
uv sync
The commands are for Linux and macOS. For Windows, see the README of the sample.
The order is 2 cars at $5,000 each, a total of $10,000. An order over $5,000 needs approval, so the workflow waits.
In the third terminal, set an order ID. The app uses it as the workflow instance ID:
export ORDER_ID=order-$(date +%Y%m%d-%H%M%S)
Run the app:
uv run dapr run -f dapr-sqlite.yaml
The log shows the activities that run before the approval, and this line:
Approval requested for order <id>. Waiting for approval.
Stop the app with Ctrl+C. The workflow is not complete.
Start the app again in the same terminal:
uv run dapr run -f dapr-sqlite.yaml
The log shows this line:
Order <id> is already running. Waiting for it to finish.
In a fourth terminal, set ORDER_ID to the ID that the app printed. Then approve the order:
export ORDER_ID=<id>
dapr workflow raise-event $ORDER_ID/ApprovalEvent --app-id order-processor --input '{"approved": true}'
The first terminal shows the payment, the inventory update, and the last line:
Workflow completed: COMPLETED
To start again with no workflow state, stop all processes. Delete the scheduler-data folder and the workflows.db file in the order-processor folder.
Follow the tutorials in this order. Each one is in the tutorials/workflow/python folder of the quickstarts repository.