title: How can I declare multiple agents in my Jenkins file and then refer to them in subsequent stages?
body: <p>I'm trying to run a jenkins file with multiple agents in it, but I'm running into errors.  Here's a snippet of my jenkins file:</p>
  
  <pre><code>pipeline {
      agent {
          docker {
              label 'agentAAA'
              ...
          }
          node {
              label 'agentBBB'
              ...
          }
      }
      ...
      stages {
          stage('to run on AAA') {
              agent {
                  label 'agentAAA'
              }
              ...
          }
          stage('to run on BBB') {
              agent {
                  label 'agentBBB'
              }
              ...
          }
          stage('to run on BBB') {
              agent {
                  label 'agentBBB'
              }
              ...
          }
  </code></pre>
  
  <p>I'm getting these errors:</p>
  
  <ul>
  <li>Only one agent type is allowed per agent section</li>
  <li>No agent type specified. Must be one of [any, docker, dockerfile, label, none]</li>
  </ul>
  
  <p>I can't find any examples in the documentation of how to refer to a previously declared agent.  I see how to declare the agent in each individual stage, but I'd end up with many repeated declarations in my file.</p>