# Global agent selector for pipelines

**URL:** <https://forum.buildkite.community/t/global-agent-selector-for-pipelines/408>\
**Category:** Features Requests\
**Created:** [April 2, 2019, 9:50pm UTC](https://forum.buildkite.community/t/global-agent-selector-for-pipelines/408 "2019-04-02T21:50:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![haraldschioberg](https://avatars.discourse-cdn.com/v4/letter/h/f1d935/32.png) [@haraldschioberg](https://forum.buildkite.community/u/haraldschioberg)\
**Post date:** [April 2, 2019, 9:50pm UTC](https://forum.buildkite.community/t/global-agent-selector-for-pipelines/408/1 "2019-04-02T21:50:21Z")

</div>

It would be really nice to be able to specify agent rules on the pipeline level, not only on the step level.

I would like a “staging” pipeline that runs the exact same steps as the main pipeline, except it adds “queue=staging” to the agent selector rules of all steps.  
I am currently faking it by having something like this in every step, and then setting BUILDKITE\_QUEUE as a pipeline env variable.

```auto
  agents:                                                                                                                                                                                              
      - "size=medium"                                                                                                                                                                                    
      - "queue=${BUILDKITE_QUEUE:-default}"
```

---

<div class="post-metadata">

**Author:** ![anon85971592](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@anon85971592](https://forum.buildkite.community/u/anon85971592)\
**Post date:** [April 3, 2019, 9:07am UTC](https://forum.buildkite.community/t/global-agent-selector-for-pipelines/408/2 "2019-04-03T09:07:17Z")

</div>

@haraldschioberg 👋 Hey! Thanks for reaching out 🙂

We support this at the moment (although it’s a little hidden - we could do a way better job of documenting this).

If you convert your pipeline to use “YAML Steps” - you’ll be able to start using `agents` as a top level key in your `pipeline.yml` file:

 ![image](https://us1.discourse-cdn.com/flex016/uploads/buildkite1/original/1X/56fdce409db343cf9825168a105a0a03431f9a6d.png)

Here’s some more information: [🚀 Setting Default Agents for a Build](https://forum.buildkite.community/t/setting-default-agents-for-a-build/111)

We’ve not been able to make it generally available at the moment due to some backwards incompatibility with old pipeline files, but it’s something we’re hoping to figure out! 🤞
