President Carter announced early this morning that the United States and Iran have reached an agreement to free the 52 American hostages and prepared to leave Washington later today to fly to Wiesbaden, West Germany, to greet the Americans after their 14 1/2 months of captivity.

The weary but obviously satisified president made the announcement at 4:55 a.m. in the White House press room.

"We have now reached an agreement with Iran which will result, I believe, in the freedom of our American hostages," he said.

"The essence of the agreement is that following the realease of our hostages then we will unfreeze and transfer to Iran a major portion of the assests which were frozen by me when the Iranians seized our embassy coompound and took our hostages."

Carter also said full agreement had been reached with Iran on arbitration procedures invoving claims between the two countries and their citizens growing out of the prolonged hostage crisis. Even as the procedures to free the hostages were being set in motion, there was cautionary not to Carter's words as he described the probable climax of the crisis that shadowed his presidency into its final hours.

"We don't yet know exactly how fast this procedure will go," the president said, adding that the United States was prepared to move as rapidly as possible.

Although there was no official announcement, the White House was making preparations in the early morning hours today for the president to make a whirlwind trip to West Germany to greet the hostages and then return to Washington in time for the inaugural ceremonies at noon tomorrow of his successor, President-elect Ronald Reagan.

Carter refused to answer questions about his personal feelings or the details of he agreement until the hostages had actually left Iran.

"I'll talk to you later," he said.

Details of the complex agreement to free the hostages were expected to be made public later today by administration officials in Washigton.

Ten minutes after Carter's announcement, White House press secretary Jody Powell announced that Deputy Secretary of State Warren Christopher, who was in Algiers, had or was about to sign the principal document that would set in motion the steps to implement the agreement to realeas the hostages.

The president's announcement climaxed a long, wearying day of high hopes for the captive Americans and the ticking of the constitutional clock on the final hours of the Carter presidency.

First Lady Rosalynn Carter and senior White House officials witnessed the dramatic announcement that Carter had longed to make for so many months.

The president, who with his wife returned to the White House from Camp David early Sunday afternoon, was up most of the night, napping occasionally on a couch in his private study adjacent to the Oval Office. Mrs. Carter, who was said to have slept some on a couch in the Oval Office, was also up most of the night.

The announcement on terms for release of the 52 American hostages came at the end of a tension-filled cliffhanger day, termed a "day of chills and thrills" by Louisa Kennedy, wife of hostage Moorhead Kennedy.

For more than eight hours preceding the final, early morning announcement, top oficials of the Carter administration met in nearly continuous session in the Oval Office sending and receiving messages to Iran through the U.S. negotiating team in Algiers and, in long periods between messages, just waiting.

Amid caution and some confusion, Washington officials steadfastly declined throughout the long day to say that a deal had been completed, despite word from Tehran early Sunday that agreement had been reached on "all the terms."

A little after 11 p.m. a high White House official reported that a final text, meeting the approval of the United States, had been in Tehran awaiting action there for several hours. Up to that point, officials of translation into three languages as well as problems of explanation to the Iranians of some of the complex provisions of the terms for the hostages' release.

"The substantive deal was done" early yesterday, according to a government source, "but then the mechanical side got kind of hung up."

The difficulty, he said, "was that the people in Iran had never read the details of an escrow account. We have had to explain to them what has to be done." As the source anticipated, the explanation apparently did not prove to be a major problem, although it was time-consuming.

The agreement hammered out with Iran calls for two escrow accounts, to be held by a third party -- in this case the Bank of England -- until each participant in the deal fulfills his obligations. At that point the holder of the funds, like a neutral party who has been holding a bet, turns over the money as directed.

While the legal and procedural education of the Iranian leaders continued, the exact language of the agreement was translated into English, Persian and French texts. Most of this work was done in Algiers.

A White House official said Carter during the day Sunday had empowered Christopher, who is in Algiers, to give U.S. approval to additional parts of the draft agreement with Iran, which has been hammered out in indirect negotiations over the past two months. The official said Carter would still have some acitons of his own to take, apparently the signing of executive orders unfreezing Iranian assets and implemetning other U.S. pledges in exchange for the hostages' release.

The 52 Americans, after medical examinations in Tehran by a team of Algerian doctors, are expected to be flown to Algiers in Algerian aircraft, a flight of more than six hours. U.S. medical evacuation aircraft are expected to pick them up there for the 2 1/2-hour flight to Wiesbaden, West Germany, their temporary home for three to five days of recuperation.

Earlier Sunday, Vice President Mondale, speaking on "Issues and Answers" (ABC, WJLA), said two differences remained to be worked out with Iran. He described one as "a minor difference" in the dollar amount of the overall sum of Iran's assets to be held by a third party, the Bank of England, as a interim step awaiting the hostages' release.

The other remaiing difference, the vice president said, was "a legal problem over certain disputed claims." White House chief of staff Jack Watson, appearing on "Meet the Press" (NC, WRC), said this problem concerned the nature of the arbitration arrangements to resolve U.S. legal claims against Iran.

Carter, spending his final weekend at the presidential retreat at Camp David, generated high expectations by flying suddenly back to Washington at 12:42 p.m. to take personal charge of the Washington end of the hostage saga.

Carter, Mondale, Secretary of State Edmund S. Muskie and other senior officials were in frequent touch by telephone with Christopher, head of the U.S. negotiating team that has been in Algiers since Jan. 7. Christopher, in turn, was reported to be busily exchanging messages with Iran through the Algerian government.

The almost continuous White House meetings throughout the day, in additon to the news from Tehran, provided clear signals to the American public and the growing crowds of waiting reporters and television crews that an end to the long drama was near.