and you shouldn't start an agent from inside the flow because the agent must already exist so that it can pick up a flow run
Usually here is how it works. You start by writing your flow - `yourflow.py`:
from prefect import task, Flow
@task(log_stdout=True)
def hello_world():
print("hello world")
with Flow("hello") as flow:
hw = hello_world()
You start an agent from one terminal:
prefect agent local start
Then in another terminal, you register your flow:
prefect register --project xxx -p /path/to/yourflow.py
Then you can trigger a run on the agent:
prefect run --project xxx --name yourflowname --watch
and then you should see that your agent picked up this flow run