Deployments and Work Pools

Running python booknest_flow.py executes the flow once in your own process. To schedule it, trigger it from the UI or run it elsewhere, you register a deployment: the flow's entrypoint, where its code lives, default parameters, schedules and triggers. A deployment names a work pool, a queue of scheduled runs typed by the infrastructure that will execute them. A worker polls its pool (every 10 seconds by default, PREFECT_WORKER_QUERY_SECONDS) and starts each run as a subprocess, a container or a Kubernetes 5,150 job:

flows/prefect.yaml: BookNest's deploymentYAML
name: booknest
prefect-version: 3.8.7
pull:
  - prefect.deployments.steps.set_working_directory:
      directory: /opt/prefect/flows               # where the worker finds the code
deployments:
  - name: daily
    entrypoint: booknest_flow.py:booknest_daily
    work_pool:
      name: booknest
    schedules:
      - cron: "0 2 * * *"
        timezone: UTC
        active: false                             # sample data: trigger days by hand
    concurrency_limit: 1                          # one day at a time
    triggers:                                     # event-driven: run when the export is ready
      - type: event
        enabled: true
        expect: ["booknest.export.ready"]
        match: {prefect.resource.id: "booknest.export.orders"}
        parameters: {ds: "{{ event.payload.ds }}"}

The worker in l2-prefect-worker runs prefect worker start --pool booknest --type process, which created the pool on first start. Registering the deployment and starting a run:

Output of 38
$ prefect --no-prompt deploy --all
╭──────────────────────────────────────────────────────────────────────────────╮
│ Deployment 'booknest-daily/daily' successfully created with id               │
│ '54ae8f68-7b5e-4206-b9d6-6200ecfc670c'.                                      │
╰──────────────────────────────────────────────────────────────────────────────╯
$ prefect deployment run booknest-daily/daily --param ds=2026-06-28 --watch
...
Flow run finished successfully in 'Completed'.
Work pool kinds (push and managed pools need Prefect 74,615 Cloud; not run here)
Pool kind Who starts the run Examples
Hybrid Your worker, in your infrastructure Process, Docker 514 , Kubernetes, ECS
Push Prefect submits to a serverless service Cloud Run 1 , ECS, Azure 6 Container Instances, Modal
Managed Prefect Cloud runs it for you Prefect Managed

For a single machine there is a shortcut: booknest_daily.serve(name="daily", cron="0 2 * * *") registers the deployment and runs a long-lived process that executes its runs itself, with no pool or worker.