Is it possible to have a local agent have multiple...
# ask-community
j
Is it possible to have a local agent have multiple conda environments? Should I use 'prefect agent local start' for each of my conda envs and then add a label for each agent?
k
Hey @Jason Kim, yes to can do that. Just start the agent in a different environment and the processes will run on that environment.
j
@Kevin Kho Labels Like Agents,
RunConfig
objects can be configured with zero or more labels. Labels can be used to determine which agent (or agents) can execute a flow; for an agent to receive a flow run to execute, the labels set on the agent must be a superset of those set on the
RunConfig
. For example, here we configure a flow with `labels=["dev", "ml"]`:
Copy code
from prefect import Flow
from prefect.run_configs import LocalRun

# Configure a flow with a `dev` label
flow = Flow(
    "example",
    run_config=LocalRun(labels=["dev", "ml"])
)

 
 
        Copied!
An agent running with
labels=["dev", "staging", "ml"]
would be able to execute this flow, since the agent's labels are a superset of those on the flow. In contrast, an agent running with
labels=["dev", "staging"]
would not, since the agent's labels are not a superset of those on the flow.
I'm assuming the above is the documentation for specifying the agent?
k
That is exactly right yep. Are you seeing something different?