Mike B
06/01/2026, 9:09 PMMarvin
06/01/2026, 9:09 PMMarvin
06/01/2026, 9:11 PMprefect deploy does not always write back to prefect.yaml by default.
What it does now is:
- If no prefect.yaml exists and you're in an interactive terminal, prefect deploy should prompt:
- Would you like to save configuration for this deployment for faster deployments in the future?
- If you say yes, it creates prefect.yaml
- If prefect.yaml already exists, Prefect uses it, but does not generally prompt again to save/update it interactively in the same way
So if you saw:
- deployment created successfully in Cloud/server
- no prompt to save
- no changes to prefect.yaml
that is consistent with one of these situations:
1. You already had a prefect.yaml in the project/root it was using
2. The command was not considered interactive
3. You were deploying in a way that bypassed the first-time save flow
A few important details:
- prefect deploy is still the correct CLI command in 3.x
- Code-based deployments via .deploy() / flow.from_source(...).deploy(...) are a separate workflow and do not rely on prefect.yaml
- prefect.yaml is mainly for YAML/project-based deployment configuration, not something Prefect guarantees it will continuously auto-sync from server-created deployments
So the short answer is: No, newly created deployments are not automatically added to prefect.yaml by default in all cases.
If you want a reusable YAML-based setup, the intended pattern is usually:
- initialize/configure your project files
- keep deployments in prefect.yaml
- use prefect deploy / prefect deploy --all from that file
Useful references:
- prefect.yaml docs
- Deploy via Python
- Deployment guides
If you want, I can also help you figure out why your specific run did not prompt — for example by checking whether Prefect was picking up an existing prefect.yaml, or by walking through the exact command you ran.Mike B
06/01/2026, 9:12 PMMarvin
06/01/2026, 9:12 PMMarvin
06/01/2026, 9:13 PMprefect.yaml exists at all. If you already have a prefect.yaml — even one created by prefect init with an empty deployments: section or no deployments configured yet — prefect deploy treats that as an existing project config and skips the first-time save prompt.
So your case:
- prefect.yaml exists
- no deployments are defined yet
- interactive terminal
=> Prefect will not prompt you to save the new deployment into that file
That behavior appears to be based on a simple “does the file exist?” check, not “does this file already contain deployment definitions?”.
So if you want the deployment persisted in prefect.yaml, you currently need to add it there yourself.
A couple of related notes:
- prefect deploy can still create the deployment in Prefect Cloud/server from CLI inputs
- but it won’t automatically round-trip that generated config back into an already-existing prefect.yaml
- if you want YAML-managed deployments, it’s best to treat prefect.yaml as the source of truth and define/edit deployments there before re-running prefect deploy
If you want, I can give you a minimal prefect.yaml deployment stanza you can paste in for your flow.Nate
06/01/2026, 9:17 PMNate
06/01/2026, 9:18 PMMike B
06/01/2026, 9:18 PMMarvin
06/01/2026, 9:18 PMMarvin
06/01/2026, 9:22 PMprefect deployment build / prefect deployment apply)
- The behavior you’re remembering with prefect deploy prompting to save new deployments into prefect.yaml was actually early Prefect 3.x behavior, not 2.x
When did it change?
It looks like this changed in Prefect 3.3.4 via PR #17519 with the change described as:
- “Only prompt to save if file does not exist”
So before that change, interactive prefect deploy would prompt more broadly when creating a deployment and could add/update entries in prefect.yaml.
After that change, the prompt only appears if:
- you are interactive, and
- prefect.yaml does not already exist
So your current experience is expected in newer 3.x releases.
Is there another CLI utility to quickly add deployment entries with the proper schema?
Short answer: not really.
There is not currently a dedicated CLI like “add this deployment to `prefect.yaml`” for an existing file.
Your current options are:
1. Manual edit of prefect.yaml
2. Use prefect init to scaffold a project/recipe, but not to append deployment entries interactively
3. Use Python-based deployments (flow.from_source(...).deploy(...) or flow.deploy(...)) instead of YAML-managed deployments
prefect init still exists, but it’s for project scaffolding, not for interactively inserting new deployment blocks into an existing prefect.yaml.
So if you want the “quickly add a correctly-shaped deployment entry” experience, today the closest thing is either:
- create a fresh project scaffold and copy the generated structure, or
- manually add a deployment block to prefect.yaml
A minimal example looks like:
yaml
deployments:
- name: my-deployment
entrypoint: flows/my_flow.py:my_flow
work_pool:
name: my-work-pool
Then run:
bash
prefect deploy --name my-deployment
or just:
bash
prefect deploy
depending on how many deployments are defined.
Relevant docs:
- prefect.yaml deployments
- Create deployments
- Deploy via Python
If you want, I can generate a copy-pasteable deployment block for your flow with the current 3.x schema — just send me:
- your flow entrypoint
- deployment name
- work pool name
- optional schedule / parameters / tagsNate
06/01/2026, 9:24 PMprefect.yaml and then prefect --no-prompt deploy --all in CI is my general recommendation
the thing that often trips people up is that prefect.yaml isn't the exhaustive state on the server, its just a declaration of what you want to exist when you run prefect deploy , but someone else might have their own specific-prefect.yaml file. some orgs like different norms, ie certain teams have their own prefect.yaml vs strictly keeping all things in one prefect.yaml per server/workspaceMike B
06/01/2026, 9:30 PMNate
06/01/2026, 9:32 PMIt'd be nice to be able to trigger that "wizard" and save the output as well-formatted YAML whenever they add a new pipeline to the repothis should happen today? ie if your
prefect.yaml exists, and you specify a new deployment by answering the wizard's questions, it should ask you to persist it as a new entry in the yaml.. if it doesn't that'd be unexpected to me and i can look into it!Mike B
06/01/2026, 9:34 PMprefect._experimental._launchers has moved to prefect._internal.launchers. The old import path will be removed in a future release.
? Would you like to configure schedules for this deployment? [y/n] (y): y
? What type of schedule would you like to use? [Use arrows to move; enter to select]
┏━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ ┃ Schedule Type ┃ Description ┃
┡━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ │ Interval │ Allows you to set flow runs to be executed at fixed time intervals. │
│ > │ Cron │ Allows you to define recurring flow runs based on a specified pattern using cron syntax. │
│ │ RRule │ Allows you to define recurring flow runs using RFC 2445 recurrence rules. │
└────┴───────────────┴──────────────────────────────────────────────────────────────────────────────────────────┘
? Cron string (0 0 * * *): 0 8 * * *
? Timezone (UTC): America/Regina
? Would you like to activate this schedule? [y/n] (y): y
? Would you like to add another schedule? [y/n] (n): n
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Deployment 'accounting_files_2/default' successfully created with id '5bbccb5e-d2e4-42fb-8aa7-99ae4526db6d'.Mike B
06/01/2026, 9:44 PM# the deployments section allows you to provide configuration
# for deploying flows
deployments:
- name: null
version: null
tags: []
description: null
schedule: {}
flow_name: null
entrypoint: null
parameters: {}
work_pool:
name: null
work_queue_name: null
job_variables:
image: '{{ build_image.image }}'
There is one warning near the end: "`prefect._experimental._launchers` has moved to prefect._internal.launchers. The old import path will be removed in a future release.".
This is a new repo, just added Prefect>=3.7.1, no customizations that I'm aware of.Nate
06/01/2026, 9:45 PMMike B
06/02/2026, 12:29 AMprefect.yaml file in the
current directory.
Will create a prefect.yaml file if one does not already exist.
Args:
- deployment: a dictionary containing a deployment configuration
"""
deployment = _format_deployment_for_saving_to_prefect_file(deployment)
current_directory_name = os.path.basename(os.getcwd())
if not prefect_file.exists():
if triggers:
deployment["triggers"] = triggers
if sla:
deployment["sla"] = sla
create_default_prefect_yaml(
".",
current_directory_name,
contents={
"deployments": [deployment],
"build": build_steps,
"push": push_steps,
"pull": pull_steps,
},
)
create_default_ignore_file(".")
else:
# use ruamel.yaml to preserve comments
ryaml = YAML()
...
proceeds to read the existing config, merge with new config, then write the new file
"Nate
06/02/2026, 2:02 AMprefect init that arose from an overly broad heuristic to stop extra prompts. will get this reviewed and update here!