Hi everyone I have a Prefect server and agent tha...
# prefect-server
a
Hi everyone I have a Prefect server and agent that is running on a virtual machine. When I add flow runs to a certain project, I add custom labels to make them easy to distinguish in the UI. What is the easiest way to update the already running Agent's labels so it can pick up new ones from the newly added flows? I have been trying to use the GraphQL to do this but I am not sure if there is built in functionality already for this? Thanks, Aniruddha
Just as a starting point, I have a "Default Agent" running but I would like to update this to change the name. I have been trying this, but obviously this does not seem to work:
😎 1
a
The easiest way is to restart the agent and set the name and labels you wish:
Copy code
prefect agent local start --name agent_smith -l l1 -l l2 -l l3
There is a mutation called update_agent_config but configuring the input for this can be painful 😅 you can check the API docs for more info - maybe you already know that you can search here
❤️ 1
a
Thanks, Anna, I actually managed to do it via the update_agent_config mutation on the GraphQL API. For anyone else interested, this is is the way to update an existing agent's name to whatever you want. In my case I wanted to update from "Default Agent" to "Agent Smith":
upvote 1
a
nice, now I learned something from you, thanks for sharing! Will cross-post to discourse for posterity 👏