View in #prefect-server on Slack
@Aniruddha_Sengupta: 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?
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:
@Anna_Geller: The easiest way is to restart the agent and set the name and labels you wish:
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
@Aniruddha_Sengupta: 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”:
@Anna_Geller: nice, now I learned something from you, thanks for sharing! Will cross-post to discourse for posterity