THE LABOR UNION leaders' visit with President Reagan the other day was a marvelously illustrative little vignette of the system at work. Neither side in that encounter needed to be terribly cordial to the other. But they cannot afford to drift totally apart.

Mr. Reagan used the occasion to offer a cautious compromise on the status of the fired air controllers. When the strike started four months ago, it got conspicuously tepid support from the rest of the labor movement. Other unions weren't moved to defend people who were already paid much more than most working people, who were already being offered much larger increases than other civil servants, and who were striking in violation of the law. But with the passage of time, people's recollections of those points have faded. Recently there's been more attention to the hardships of the fired controllers and the accusations that Mr. Reagan is a union- buster. Too close an embrace by the unions' leadership would only make trouble for Mr. Reagan elsewhere in his constituency. But the unions' membership is another matter. A lot of the people who voted for Mr. Reagan last year belong to unions, and he'd like to keep them with him.

The Federal Aviation Administration is absolutely opposed to letting the fired controllers return to their former jobs. Feelings run high between those controllers who struck and those who did not; the FAA does not want to bring those animosities back into the control towers. But Mr. Reagan wants to deflect the charges of vindictiveness and hostility to labor. He hinted that he would allow the strikers to apply for other federal jobs, under conditions not yet specified.

The AFL-CIO, for its part, has declared its intention to make itself an integral part of a rebuilt Democratic Party. That sets a certain constraint on its relations with Mr. Reagan. But meanwhile, at another level, there's a constant flow of routine concerns that unions need to discuss with any administration regardless of the party running it. There are the questions that come up in the daily operation of programs like unemployment compensation. There are appointments to all those boards and commissions that, despite their obscurity, profoundly affect the interests of the unions.

Neither side is retreating on the great issues of public policy that divide them. But both recognize that there are interests to be mollified, and small bargains to be struck. Mr. Reagan and the unions have decided to relax the cold war a little and encourage the conduct of a certain amount of routine business. The conversation at the White House was what the diplomats call a full and candid exchange of views. The result was what the diplomats call progress toward detente.