Python Workflows SDK

Last updated Sep 17, 2026 Workflow entrypoints can be declared using Python. To achieve this, you can export a WorkflowEntrypoint that runs on the Cloudflare Workers platform. Refer to Python Workers for more information about Python on the Workers runtime.

Get Started

The main entrypoint for a Python workflow is the WorkflowEntrypoint class. Your workflow logic should exist inside the run handler.

from workers import WorkflowEntrypoint

class MyWorkflow(WorkflowEntrypoint):
    async def run(self, event, step):
        # steps here

For example, a Workflow may be defined as:

from workers import Response, WorkflowEntrypoint, WorkerEntrypoint

class PythonWorkflowStarter(WorkflowEntrypoint):
    async def run(self, event, step):

        @step.do('step1')
        async def step_1():
            # does stuff
            print('executing step1')

        @step.do('step2')
        async def step_2():
            # does stuff
            print('executing step2')

        await step_1()
        await step_2()

class Default(WorkerEntrypoint):
    async def fetch(self, request):
        await self.env.MY_WORKFLOW.create()
        return Response("Hello world!")

You must add both python_workflows and python_workers compatibility flags to your Wrangler configuration file.

{
    "$schema": "./node_modules/wrangler/config-schema.json",
    "name": "hello-python",
    "main": "src/entry.py",
    "compatibility_flags": [
        "python_workers",
        "python_workflows"
    ],
    // Set this to today's date
    "compatibility_date": "2026-10-27",
    "workflows": [
        {
            "name": "workflows-demo",
            "binding": "MY_WORKFLOW",
            "class_name": "PythonWorkflowStarter"
        }
    ]
}
"$schema" = "./node_modules/wrangler/config-schema.json"
name = "hello-python"
main = "src/entry.py"
compatibility_flags = [ "python_workers", "python_workflows" ]
# Set this to today's date
compatibility_date = "2026-10-27"

[[workflows]]
name = "workflows-demo"
binding = "MY_WORKFLOW"
class_name = "PythonWorkflowStarter"

To run a Python Workflow locally, use Wrangler, the CLI for Cloudflare Workers:

npx wrangler@latest dev

To deploy a Python Workflow to Cloudflare, run wrangler deploy:

npx wrangler@latest deploy

Join the #python-workers channel in the Cloudflare Developers Discord ↗︎ and let us know what you would like to see next.

Was this helpful?

YesNo

On this page

Python Workflows SDK - 图1Docs

{"@context":"https://schema.org","@type":"WebPage","@id":"https://developers.cloudflare.com/workflows/python/#page","headline":"Python Workflows SDK","description":"Build Cloudflare Workflows using the Python SDK with WorkflowEntrypoint on the Workers platform.","url":"https://developers.cloudflare.com/workflows/python/","inLanguage":"en","image":"https://developers.cloudflare.com/workflows/python/og.png?v=69ce2605c3c89377","dateModified":"2026-09-17","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}


description: Trigger and manage Workflows from Python Workers using FFI bindings to Cloudflare resources. title: Interact with a Workflow image: https://developers.cloudflare.com/workflows/python/bindings/og.png?v=6cff989783879f23


Skip to content

Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/workflows/llms.txt
Use this file to discover all available pages before exploring further.