Ronald Reagan headed toward a triumphant inauguration today as the 40th president of the United States in the shadow of a drama being played out in Tehran and Algiers.

In a mood which a close aide described as "buoyant," Reagan prepared to take the reins of power from the man he defeated in November and then send Jimmy Carter to Germany to welcome the returning American hostages. Reagan said it would not be appropriate for him to go because he had not arranged the tradeoff of Iranian assets for freedom of the captive Americans.

Though in part it overshadowed his inauguration, Reagan and his top aides viewed the prospective release of the hostages in Iran as a blessing for their new administration as well as for the nation. These aides said liberation of the hostages would make it much easier for Reagan to focus attention on the nation's economic problems in his first days in office.

"As long as Americans were held in captivity overseas, they would have to be a high priority for any president," said one Reagan adviser.

Reagan and Carter talked by phone at 9:30 a.m. yesterday, and the president-elect was given a copy of the proposed agreement with Iran. Leaving Blair House for a meetings with his advisers and Cabinet members, Reagan told reporters he thought he could go along with terms of the agreement.

Throughout the long transition, the out-going and incoming adminstrations have tried to work together on the hostage issue.

"We've consulted with the Carter adminstration and carefully coordinated our own response with them," said White House counselor Edwin Meese III.

That coordination continued yesterday as transition spokesman James Brady, who today will become the White House press secretary, announced formation of "an interagency task force" to work on the hostage situation after the change of administrations.

On the eve of his inauguration, Reagan was in a happy mood.

"I think he's buoyant and moved by this week's activities . . .," said longtime aide Michael Deaver."He's as relaxed as I've ever seen him."

And while the attention of the nation was focused on the hostages, committees in the Republican-controlled Senate unanimously approved six more members of the president-elect's Cabinet.

Two Cabinet members have yet to receive committee clearance. Approval of one, Secretary of Housing and Urban Development-designate Samuel Pierce, was considered certain. But the prospects of Labor Secretary-designate Raymond Donovan, who is under investigation by the Senate Labor Committee, remain uncertain.

While the Senate was nearing completion confirmation for other high Reagan appointees, the Reagan transition team was struggling to complete appointment of second-level executives.

Delay in naming these key players is one obstacle to a fast start by the new administration. A week ago transition officials said 60 to 100 sub-Cabinet and other senior officials would be named by yesterday, but a logjam apparently developed in the transition personnel office.

It now appears likely Reagan will take office with a number of sub-Cabinet positions still unfilled.

"If we've learned one thing, we've learned never to set deadlines," said Larry Speakes, a veteran of the Ford White House who was named a deputy press secretary yesterday.

Nevertheless, the mood in the Reagan camp was one of optimism as the moment neared for the former California governor's extravagant and glamorous inaugural.

This mood will be echoed in Reagan's carefully prepared inaugural address, which will appeal for renewal of American greatness rather than a call to think small and learn to live with shrinking resources.

Meese said Reagan will call for "a renewal of spirit, a renewal of the economy, a renewal of America's place in the world."

"It's not a hairshirt speech; it doesn't tell people to do without," another senior Reagan adviser said.

Reagan has promised to hit the ground running with a series of executive orders intended to demonstrate he is serious about cutting cost of federal government. One of the first, which Reagan pledged during the campaign to issue on his first day of office, is a freeze on federal hiring more stringent than the existing freeze. Reagan's goal is to reduce the federal workforce 5 percent.

Other executive orders are expected to abolish the Council on Wage and Price Stability, eliminating 200 jobs in the executive office of the president, and impose a moratorium on new federal regulations.

The hope of the new administration is that Reagan's demonstrated skills in swaying public opinion can be used to build a political fire under Congress.

"The appeal for public support will start on Tuesday and never let up," Meese said.

The six Reagan Cabinet choices who won unanimous approval from Senate committees yesterday are Donald Regan, treasury; Richard Schweiker, health and human services; John Block, agriculture; Casper Weinberger, defense; Malcolm Balridge, commerce, and Andrew Lewis, transportation.

Committees also approved William Brock to be special trade respresentative, William Casey to be director of the Central Intelligence Agency, Frank Carlucci to deputy defense secretary and Darrel Trent to be deputy transportation secretary.

Reagan spent his last day as president-elect emphazing the policies he plans to make good on his promises to turn the economy around. He spent a quiet afternoon and then helicoptered to the Capital Centre for the pre-inauguration gala.