The agreement highlighted the gap between what Mr. Trump sees as the proper approach to a resurgent Russia and how lawmakers — even Republicans who broadly support Mr. Trump — want to proceed. While Mr. Trump has dangled the possibility of negotiating a deal to lift sanctions, Mr. Putin’s top objective, the congressional response is to expand them.
The White House did not respond publicly to the legislation. But two senior administration officials said they could not imagine Mr. Trump vetoing the measure in the current political atmosphere, even if he regards it as interfering with his executive authority to conduct foreign policy. Still, as ever, Mr. Trump retains the capacity to surprise, and this would be his first decision about whether to veto a significant bill.
Congress has complicated his choice because the legislation also encompasses new sanctions against Iran and North Korea, two countries the administration has been eager to punish for their activities.
There are still hurdles to clear in a Capitol where the Republican majorities have been reticent to confront Mr. Trump. Some party leaders were silent about the agreement on Saturday, including Senator Mitch McConnell of Kentucky, the majority leader, and Senator Bob Corker of Tennessee, the chairman of the Senate Foreign Relations Committee.
Others took care to note the misdeeds of all three countries being targeted for sanctions.
In a statement from two California Republicans — Kevin McCarthy, the House majority leader, and Ed Royce, the chairman of the House Foreign Affairs Committee — the lawmakers said, “North Korea, Iran and Russia have in different ways all threatened their neighbors and actively sought to undermine American interests.”
They added, “The bill the House will vote on next week will now exclusively focus on these nations and hold them accountable for their dangerous actions.”
A spokeswoman for Speaker Paul D. Ryan, AshLee Strong, said the bill “would hold three bad actors to account.”
A sanctions package had stalled in the Republican-led House for weeks after winning near-unanimous support in the Senate last month. Democrats accused Republicans of delaying quick action on the bill at the behest of the Trump administration, which had asked for more flexibility in its relationship with Russia and took up the cause of oil and gas companies, defense contractors and other financial players who suggested that certain provisions could undercut profits.
The House version of the bill includes a small number of changes, technical and substantive, from the Senate legislation, including some made in response to concerns raised by American energy companies.
Those tweaks — and the addition of North Korea sanctions to a Senate package that included only Russia and Iran, months after the House approved sanctions against North Korea by a vote of 419 to 1 — helped end the impasse.
The House version of the bill was set for a vote on Tuesday, according to Mr. McCarthy’s office.
The agreement comes at a particularly uncomfortable moment for the White House. Sanctions are central to the mystery over Donald Trump Jr.’s meeting with a Russian lawyer and others on June 9, 2016, where he said the topic of adoption came up. That was a reference to Mr. Putin’s decision to ban American adoptions of Russian children in response to sanctions Congress passed over human rights issues.
The discussions that the president’s former national security adviser, Michael T. Flynn, held with the Russian ambassador to the United States during the transition were also said to be about sanctions, including President Barack Obama’s decision, in his last weeks in office, to evict Russia from two of its diplomatic compounds in the United States. Mr. Trump must soon decide whether to return them.
For months, lawmakers have agreed on the need to punish Russia, separating the issue from others, such as immigration and health care, that have been mired in partisan wheel-spinning. The unity has placed Republicans in the unusual position of undercutting their own president on a particularly awkward subject.
Yet politically, the collaboration delivers benefits to members of both parties. Democrats have sought to make Russia pay for its 2016 election interference, which many of them believe contributed to Mr. Trump’s triumph over Hillary Clinton. And Republicans, who have long placed an aggressive stance toward Russia at the center of their foreign policy, can quiet critics who have suggested they are shielding the president from scrutiny by failing to embrace the sanctions.
Senator Chuck Schumer of New York, the minority leader, said he expected this “strong” bill to reach the president’s desk promptly “on a broad bipartisan basis.”
In the House, Representative Steny H. Hoyer of Maryland, the minority whip, praised the agreement’s stipulation that “the majority and minority are able to exercise our oversight role over the administration’s implementation of sanctions.”
Representative Nancy Pelosi of California, the Democratic leader, registered concerns about adding sanctions against North Korea to the package, questioning whether it would prompt delays in the Senate. Mr. Schumer and Mr. Cardin expressed no such anxieties on Saturday.
As House Republican leaders like Mr. Ryan chafed at the suggestion that they were doing the White House’s bidding by not taking up the measure immediately, the administration sought to pressure members by insisting that the legislation would unduly hamstring the president.
Mr. Trump’s aversion to sanctions targeting Russia is not new. During the campaign, he questioned whether the United States should retain existing sanctions on Russia, imposed after Mr. Putin seized Crimea from Ukraine.
Under the wording in the legislative deal, it would be difficult, but not impossible, for the president to undercut sanctions without congressional approval.
The administration could stall in identifying individuals and companies subject to new sanctions. To lift existing sanctions related to Ukraine, Mr. Trump would have to certify that the conditions that prompted them had been reversed.
And to end sanctions over Russian cyberattacks, he would have to provide similar evidence that Russia had tried to reduce the number and intensity of such intrusions, an unlikely prospect.
Mr. Trump still regularly questions the intelligence showing that Russia sought to interfere in the election. He has suggested that because evidence was processed by people he deems hostile to his White House — including Obama administration officials and James B. Comey, the former F.B.I. director he fired — the conclusion is inherently tainted.