You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
12
+
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.
13
13
14
14
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.
15
15
@@ -36,9 +36,10 @@ class PythonWorkflowStarter(WorkflowEntrypoint):
36
36
37
37
await my_second_step()
38
38
39
-
asyncdefon_fetch(request, env):
40
-
await env.MY_WORKFLOW.create()
41
-
return Response("Hello Workflow creation!")
39
+
classDefault(WorkerEntrypoint):
40
+
asyncdeffetch(self, request):
41
+
awaitself.env.MY_WORKFLOW.create()
42
+
return Response("Hello Workflow creation!")
42
43
```
43
44
44
45
:::note
@@ -47,4 +48,4 @@ Python Workflows requires a `compatibility_date = "2025-08-01"`, or lower, in yo
47
48
48
49
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.
49
50
50
-
To learn more and get started, refer to [Python Workflows documentation](/workflows/python/).
51
+
To learn more and get started, refer to [Python Workflows documentation](/workflows/python/).
Copy file name to clipboardExpand all lines: src/content/docs/workflows/python/python-workers-api.mdx
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -141,13 +141,13 @@ class DemoWorkflowClass(WorkflowEntrypoint):
141
141
142
142
### Create an instance via binding
143
143
144
-
Note that `env` is a Javascript object exposed to the Python script via [JsProxy](https://pyodide.org/en/stable/usage/api/python-api/ffi.html#pyodide.ffi.JsProxy). You can
145
-
access the binding like you would on a Javascript worker. Refer to the [Workflow binding documentation](/workflows/build/workers-api/#workflow) to learn more about the methods available.
144
+
Note that `env` is a JavaScript object exposed to the Python script via [JsProxy](https://pyodide.org/en/stable/usage/api/python-api/ffi.html#pyodide.ffi.JsProxy). You can access the binding like you would on a JavaScript worker. Refer to the [Workflow binding documentation](/workflows/build/workers-api/#workflow) to learn more about the methods available.
146
145
147
146
Let's consider the previous binding called `MY_WORKFLOW`. Here's how you would create a new instance:
0 commit comments