It began as an uncertain presidential shuttle and it ended in a tour de force.

At 5:05 p.m., an hour and a half later than expected, Presidents Carter and Sadat strode out of the VIP pavilion of Cairo International Airport, between the tall marbled columns and down the red carpet to the microphone.

Just 18 hours earlier, back in Jerusalem, Carter's advisers had been decidedly down as they talked about how no compromise seemed in sight and the prospect of failure seemed clear. Now Carter looked somber, even grim, and certainly exhausted as he approached the microphone.

Carter gestured for Sadat to speak first. Sadat gestured for Carter to speak first. Then Carter spoke, his face showing strain and not elation. But his words made it clear that his unprecedented attempt at shuttle summitry had achieved the success few of his own advisers had even dared to hope for when they left Washington.

"I am convinced that now we have defined all of the main ingredients of a peace treaty between Egypt and Israel and which will be the cornerstone of a comprehensive settlement in the Middle East," he said.

Then he turned and left, pausing only for the obligatory anthems. Fifteen minutes after he had walked out the pavilion door, Air Force One was roaring into the sky. He came, he said his piece, he left. And in his wake there was only a stunned silence -- not even a silver bullet was left behind.

On the ground, Anwar Sadat was not talking. He too was grim and he was turning his back on the cameras and making for his helicopter. There in the barricaded bullpen, on this day that just might be one of the greatest in the history of the Middle East, there was quiet -- no cheers, no shouts -- and finally there was the sound of reporters interviewing each other, for there was no one left to talk to and the moment seemed too grand to be left in silence.

Jimmy Carter had broken all of the conventions and traditions of diplomacy. The rules of the game say the top leaders never venture onto foreign soil unless they know just what is going to happen. They leave the messiness of negotiating, the give-and-take and the infighting and bluffing, to the technicians.

Sen. Jacob Javits (R-N.Y.) -- had wished Carter well just before he left Washington, but he could not help adding that he assumed Carter had a Mideast peace agreement all tied down because if he did not he was "crazy" for going.

But the president and his men kept saying that things were in no way tied down -- in fact, there were no strings attached at all, they said.

So Carter broke convention and tradition, doing it in a way none of his predecessors had dared -- and he accomplished something none of them ever had. He got the Israeli leader and the Egyptian leader to agree to the same terms of the same treaty of peace.

Just a month ago, Anwar Sadat would not even dare utter the notion of a separate treaty and Menachem Begin recoiled from even the slightest suggestion of autonomy for Palestinians in the occupied areas. Now they are agreeing to all that and more.

Perhaps it can still fall apart. The Cabinet in Israel can turn against Begin or the Knesset can turn against the Cabinet. The treaty language could be rejected or revised. But that is not what American officials expect. Even if it all does fall, the accomplishment of Jimmy Carter is now established as a personal success -- and if peace becomes reality, it will go down as one of the true diplomatic triumphs.

For Jimmy Carter, it comes at a much appreciated time. He has plummeted in the polls at home and he is rated a 2-to-1 loser among those of his own party when he is put up against Sen. Edward Kennedy (D-Mass.).

The rap on Carter has been that he was not a leader and was not competent. But by doing his diplomacy in his own way he may well have reversed that public opinion slide and carved a special place for himself.

Last night, in Jerusalem, American officials were doubtful that a compromise could be reached. But then, after Carter had decided to end his shuttle summit and return to Washington after a quick airport briefing for Sadat, Israeli Foreign Minister Moshe Dayan telephoned Secretary of State Cyrus Vance.

The two men discussed the issues and then met, from 9:15 to 10:30 p.m. for what was described as an "informal chat."

This morning Carter and Begin breakfasted alone from 8:30 to 10 a.m. and they discussed compromise language that had been worked out by the American side, which was still looking for something that would be acceptable to both Israel and Egypt. At 10 a.m. Vance, Dayan, and presidential adviser Zbigniew Brzezinski entered the president's suite at the King David Hotel in Jersalem and met with Carter and Begin for almost an hour.

Begin agreed there to submit the American compromise proposals to his Cabinet.

Last night in Jerusalem. the Carter officials had faced the end of the shuttle summitry with downcast expectations. It looked as if there could be no compromise.

Perhaps their words added to the pressure that moved Israel, and then Egypt, to come to terms. And perhaps not. But Jody Powell said he meant to give good guidance when he reported on last night's sessions, and not to mislead.

"Any time you think youcan do better getting the news without any help from me, you are welcome to it," he told reporters today. "But I did the best I could to give an accurate portrayal of the situation last night and I think the more you know about what has transpired, the more accurate that description would be."

The deed was done. And tonight, in a hastily assembled press room in a Cairo hotel, the same Carter men who had been so downcast last night were backslapping and joking. Peace, and perhaps the presidency. were at hand.