WASHINGTON ― Republican and Democratic senators on Tuesday afternoon announced they had reached an agreement on how to stabilize the Affordable Care Act’s private insurance markets, offering hope that bipartisan action on “Obamacare” might actually be possible.

But those hopes seemed dimmer by the evening, when President Donald Trump, who had praised the deal just hours before, called it a “bailout for insurance companies” ― a sentiment he repeated Wednesday morning on Twitter.

The bipartisan agreement would fund the so-called Cost Sharing Reductions, which reimburse insurers for the cost of special, more generous plans they offer exclusively to low-income customers. Trump announced last week that he planned to stop those subsidy payments, which have been the subject of an ongoing legal dispute, in an effort to further dismantle Obamacare.

But rather than blow up the law, the president’s move seemed to reignite negotiations between the ranking members of the Senate Health, Education, Labor and Pensions Committee, Republican Lamar Alexander of Tennessee and Democrat Patty Murray of Washington. For weeks, the two had discussed ways of funding the CSR payments while giving states more flexibility on the plans they offer.

“This takes care of the next two years,” Alexander, the committee’s chairman, told reporters on Tuesday. “After that, we can have a full-fledged debate on where we go long-term on health care.”

Alexander was careful to point out the proposal’s relatively narrow scope: “I’d like to undersell it, not oversell it.” But it is expected to get significant support from Democrats. Alexander said he and Murray were now working to get cosponsors from both sides of the aisle and to present Majority Leader Mitch McConnell (R-Ky.) and Minority Leader Chuck Schumer (D-N.Y.) with a bill by the end of the week.

While the actual deal itself is still being finalized, Alexander’s description was that, in exchange for funding the payments to insurers, the agreement would amend the authority of the Department of Health and Human Services to accept more state applications to waive certain provisions of the Affordable Care Act.

The changes, according to Senate aides, would allow HHS to approve waiver requests more quickly, speeding up a process that state officials have frequently decried as too slow. The agreement would also allow governors to seek waivers on their own authorities rather than seeking acts of state legislatures.

The changes would also clear the way for insurers to offer policies with higher deductibles and out-of-pocket costs than the law allows today ― effectively adding a layer of “copper” plans that would be less generous than the minimal “bronze” plans now on the market. The theory is that such plans would have lower premiums and would give individuals the option of more “catastrophic coverage” insurance.

Alexander got language allowing states to show their waiver requests will achieve “comparative affordability,” which basically means they would have more leeway over who ends up with what kind of insurance. Murray signed off on this, Senate aides said, but only after Alexander agreed to additional language protecting low-income consumers, people with serious medical problems and other “vulnerable” populations.

As a carrot to Democrats, the deal adds more than $100 million in outreach funding to promote ACA signups, basically replacing the money that the Trump administration has cut, and it would authorize new spending to finance reinsurance programs, which help reduce premiums by reimbursing insurers for some of the costs associated with their most expensive beneficiaries. (Congress would still have to appropriate that money separately.)

Alexander made it clear that other key protections in the Affordable Care Act, including a requirement that all plans cover “essential health benefits” ― including maternity care, prescription drugs and hospitalization ― would remain in place. So would the prohibition on denying coverage or charging higher premiums to people with pre-existing conditions.

“But it does give states significant new flexibility in terms of offering policies,” Alexander said.

When McConnell was asked about the tentative deal ― whether it was a “tacit endorsement” of Obamacare ― he said Republicans hadn’t had a chance to think about the way forward yet and he referred questions to Alexander and Murray.

Trump was less circumspect ― and also less consistent.

Early in the day, Trump suggested that Obamacare was “virtually dead” ― “as far as I’m concerned, it really is dead” ― and he bashed the CSR payments as money that “goes to the insurance companies to line their pockets.”

These statements were consistent with what Trump said on Monday, when he was emphatic that Obamacare was “finished.”

“It’s dead. It’s gone. You shouldn’t even mention it. It’s gone. There is no such thing as Obamacare anymore,” Trump said in the Rose Garden.

But later on Tuesday, Trump said the White House was involved in the negotiations with Alexander and Murray and he suggested that he could support the deal.

“But it is a short-term solution so that we don’t have this very dangerous little period, including dangerous period for insurance companies, by the way, for a period of one year, two years, we will have a very good solution,” Trump said. “But we are going to have a great solution, ultimately, for health care, okay? But they are working together. And I know very much what they’re doing, okay?”

“It will get us over the intermediate hump,” Trump said.

By Tuesday evening, Trump seemed less enthusiastic, praising the bipartisan effort but criticizing the agreement itself. “I’m pleased the Democrats have finally responded to my call for them to take responsibility for their Obamacare disaster and work with Republicans to provide much-needed relief to the American people,” Trump said during a speech at the Heritage Foundation.

“While I commend the bipartisan work done by Senators Alexander and Murray ― and I do commend it ― I continue to believe Congress must find a solution to the Obamacare mess instead of providing bailouts to insurance companies,” Trump said.

Then, the next morning, he tweeted out the same thoughts.

I am supportive of Lamar as a person & also of the process, but I can never support bailing out ins co's who have made a fortune w/ O'Care. — Donald J. Trump (@realDonaldTrump) October 18, 2017

It’s not clear how, if at all, this deal would affect plans and options for next year, given that open enrollment is set to begin in less than three weeks. Many carriers raised their rates preemptively for 2018, in case Trump cut off the insurer payments, while others are scrambling to do so now.

If the insurers get the payments after all, because some version of the Alexander-Murray agreement becomes law, the carriers will end up with extra money. There are ways to avoid that ― like having the insurers give consumers rebates, or somehow finding a way to let them bring premiums back down. Senators said they were aware of the problem and working on ways to make sure insurers don’t “double dip”, as Schumer put it, although they gave no details about what ideas were under discussion.

It’s also still unclear whether the agreement has enough support in Congress. As Alexander said Tuesday, he and Murray were working now to build bipartisan support. It seems likely that, in the Senate, nearly all Democrats would vote for the deal, as would a number of Republicans.

When HuffPost asked GOP lawmakers about CSR payments on Tuesday, rank-and-file Republicans sounded supportive of doing something to ensure that premiums were workable.

“It’s probably a good idea for Congress to step in and at least address that part of the issue,” Sen. Mike Crapo (R-Idaho) told HuffPost.

Kansas Republican Sen. Pat Roberts said anything lawmakers could do on health care to provide some relief would be a positive step. Sen. John Barrasso (R-Wy.) said he had encouraged Alexander to work with Murray toward an agreement. And Sen. Susan Collins (R-Maine), one of the three Republicans who was steadfast in her opposition to repealing Obamacare, said she was “very optimistic” about a bipartisan deal.

The big questions now are whether McConnell will bring the deal to the floor in the Senate, and whether House Speaker Paul Ryan (R-Wis.) would do the same in the House.

The speaker’s office did not immediately respond to a request for comment.

Democrats could insist on passage of the CSR payments on a number of upcoming must-pass bills, including a government funding measure in December.

But the deal ultimately hinges on Trump. It’s hard to imagine Senate or House Republicans ― particularly McConnell or Ryan ― standing up to Trump on not passing a CSR bill, particularly because so few GOP lawmakers will be needed to get such a bill over the finish line.

And after Tuesday, counting on Trump’s support for the proposal would seem like a foolish bet.

Tom Williams via Getty Images

This article has been updated to include additional information about the Alexander-Murray deal and Trump’s comments on Tuesday evening, as well as a tweet from Trump on Wednesday.