<@ULVA73B9P> can i run a flow with no deployment f...
# ask-marvin
l
@Marvin can i run a flow with no deployment from the python sdk?
m
thought for 47.7 seconds
Yes. In Prefect 3.x you can run a flow directly from Python without creating a deployment—just call the flow function like a normal function. Example:
Copy code
from prefect import flow, task, get_run_logger

@task
def say_hi(name):
    logger = get_run_logger()
    <http://logger.info|logger.info>(f"Hi, {name}!")

@flow
def my_flow(name: str = "world"):
    say_hi(name)

if __name__ == "__main__":
    my_flow("Marvin")  # no deployment needed
Notes: - If your environment is connected to Prefect Cloud/Server (via
PREFECT_API_URL
and
PREFECT_API_KEY
), this ad‑hoc run will be tracked in the UI even without a deployment. - If not connected, it will run locally with Prefect orchestration features (retries, caching, logging) but won’t appear in a UI. Do you want it tracked in Cloud/Server or just run locally?