code: public void terminate() throws InterruptedException, IOException {
          final Computer computer = toComputer();
          if (computer != null) {
              computer.recordTermination();
          }
          try {
              // TODO: send the output to somewhere real
              _terminate(new StreamTaskListener(System.out, Charset.defaultCharset()));
          } finally {
              try {
                  Jenkins.get().removeNode(this);
              } catch (IOException e) {
                  LOGGER.log(Level.WARNING, "Failed to remove "+name,e);
              }
          }
      }
docs: Releases and removes this agent.