Neil Natarajan

08/24/2022, 4:49 PM
Is there a way to start a prefect agent via code instead of manually using the CLI?

Sam Garvis

08/24/2022, 4:51 PM
Like using helm in k8s? Or do you mean in Python?

Neil Natarajan

08/24/2022, 4:53 PM
in python
I just want to run a simple flow on an interval schedule locally
But I don't want to have manual intervention in the form of starting an agent
Currently, I am able to create the deployment/work-queue via Python API but I do not know how to start an agent via Python API

Jean Luciano

08/24/2022, 4:58 PM
Only ways of starting an agent is with the CLI command or a helm chart.

Ryan Peden

08/24/2022, 5:05 PM
Although there are no official docs on running an agent via the Python API, the
class is documented here: and you can see how the CLI creates an and runs an agent here: But note that is not a documented part of Prefect's Python API so it may not be safe to count on it working in perpetuity.
👀 1

Neil Natarajan

08/24/2022, 5:07 PM
Thanks, I'll take a look