Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
title: Build durable multi-step applications in Python with Workflows (now in beta)
description: Python Workflows is now open beta - build Workflows in Python.
products:
- workflows
- workers
date: 2025-08-22
---

import { Render, PackageManagers, TypeScriptExample } from "~/components"

You can now build [Workflows](/workflows/) using Python. With Python Workflows, you get automatic retries, state persistence, and the ability to run multi-step operations that can span minutes, hours, or weeks using Python’s familiar syntax and the [Python Workers](/workers/languages/python/) runtime.

Python Workflows use the same step-based execution model as JavaScript Workflows, but with Python syntax and access to Python’s ecosystem. Python Workflows also enable [DAG (Directed Acyclic Graph) workflows](/workflows/python/dag/), where you can define complex dependencies between steps using the depends parameter.

Here’s a simple example:

```python
from workers import Response, WorkflowEntrypoint

class PythonWorkflowStarter(WorkflowEntrypoint):
async def run(self, event, step):
@step.do("my first step")
async def my_first_step():
# do some work
return "Hello Python!"

await my_first_step()

await step.sleep("my-sleep-step", "10 seconds")

@step.do("my second step")
async def my_second_step():
# do some more work
return "Hello again!"

await my_second_step()

async def on_fetch(request, env):
await env.MY_WORKFLOW.create()
return Response("Hello Workflow creation!")
```

:::note
Python Workflows requires a `compatibility_date = "2025-08-01"`, or lower, in your wrangler toml file.
:::

Python Workflows support the same core capabilities as JavaScript Workflows, including sleep scheduling, event-driven workflows, and built-in error handling with configurable retry policies.

To learn more and get started, refer to [Python Workflows documentation](/workflows/python/).
10 changes: 10 additions & 0 deletions src/content/docs/workflows/python/bindings.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ sidebar:
---
import { WranglerConfig } from "~/components"

:::caution[Python Workflows are in beta, as well as the underlying platform.]

You must add both `python_workflows` and `python_workers` compatibility flags to your `wrangler.toml` file.

Also, Python Workflows requires `compatibility_date = "2025-08-01"`, or lower, to be set in your `wrangler.toml` file.
:::

The Python Workers platform leverages FFI to access bindings to Cloudflare resources. Refer to the [bindings](/workers/languages/python/ffi/#using-bindings-from-python-workers) documentation for more information.

From the configuration perspective, enabling Python Workflows requires adding the `python_workflows` compatibility flag to your `wrangler.toml` file.
Expand Down Expand Up @@ -67,6 +74,7 @@ Create (trigger) a new instance of a given Workflow.

```python
from pyodide.ffi import to_js
from js import Object

async def on_fetch(request, env, ctx):
event = {"foo": "bar"}
Expand All @@ -93,6 +101,7 @@ Each element of the `batch` list is expected to include both `id` and `params` p

```python
from pyodide.ffi import to_js
from js import Object

# Create a new batch of 3 Workflow instances, each with its own ID and pass params to the Workflow instances
listOfInstances = [
Expand Down Expand Up @@ -134,6 +143,7 @@ Send an event to a workflow instance.

```python
from pyodide.ffi import to_js
from js import Object

await env.MY_WORKFLOW.send_event(to_js({ "type": "my-event-type", "payload": { "foo": "bar" } }, dict_converter=Object.fromEntries))
```
Expand Down
2 changes: 2 additions & 0 deletions src/content/docs/workflows/python/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Refer to [Python Workers](/workers/languages/python) for more information about

You must add both `python_workflows` and `python_workers` compatibility flags to your `wrangler.toml` file.

Also, Python Workflows requires `compatibility_date = "2025-08-01"`, or lower, to be set in your `wrangler.toml` file.

Join the #python-workers channel in the [Cloudflare Developers Discord](https://discord.cloudflare.com/) and let us know what you'd like to see next.
:::

Expand Down
6 changes: 6 additions & 0 deletions src/content/release-notes/workflows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ entries:
Workflows can now be tested with new test APIs available in the "cloudflare:test" module.

More information available in the Vitest integration [docs](/workers/testing/vitest-integration/test-apis/#workflows).
- publish_date: "2025-08-22"
title: "Python Workflows is now open beta"
description: |-
[Python Workflows](/workflows/python/) is now in open beta, and available to any developer a free or paid Workers plan.

More information available in the [changelog](/changelog/2025-08-22-workflows-python-beta/).
- publish_date: "2025-05-07"
title: "Search for specific Workflows"
description: |-
Expand Down
Loading