https://prefect.io logo
Setup Prefect agent as background process
s

scott

12/07/2022, 7:27 PM
I’m trying to sort out how to run prefect agents as background processes. Running an agent alone interactively works well (connects with work queue perfectly). But then I tried to run as a background process using supervisor via systemctl, and the agent is running, but it’s not connected to the work queue previously created - the work queue in the app.prefect.cloud UI is in an unhealthy state. Any troubleshooting tips?
1
ah,
Ephemeral API
… needed to set
PREFECT_API_URL
and
PREFECT_API_KEY
n

Nate

12/07/2022, 7:41 PM
yep, wherever the agent runs will need those env vars to be set so it can communicate with cloud (or your instance of the server) here's a setup guide if you haven't seen it
👍 2
s

scott

12/07/2022, 7:49 PM
Related-ish question: Any guidelines on how many agents to use?
n

Nate

12/07/2022, 7:53 PM
I'd say that it depends highly on your objectives / runtime infra, but generally I'd say agents are 1 to 1 with execution environments
s

scott

12/07/2022, 7:55 PM
thanks!