After weeks of tense wrangling between the White House and House Republicans, the fiscal deal reached on Saturday to raise the debt ceiling while constraining federal spending bolsters President Biden’s argument that he is the one figure who can still do bipartisanship in a profoundly partisan era.

But it comes at the cost of rankling many in his own party who have little appetite for meeting Republicans in the middle and think the president cannot stop himself from giving away too much in an eternal and ephemeral quest for consensus. And it will now test his influence over fellow Democrats he will need to pass the deal in Congress.

The agreement in principle that he reached with Speaker Kevin McCarthy represents a case study in governing for Mr. Biden’s presidency, underscoring the fundamental tension of his leadership since the primaries in 2020 when he overcame progressive rivals to win the Democratic nomination. Mr. Biden believes in his bones in reaching across the aisle even at the expense of some of his own priorities.

He has shown that repeatedly since being inaugurated two and a half years ago even as skeptics doubted that cross-party accommodation was still possible. Most notably, he pushed through Congress a bipartisan public works program directing $1 trillion to building or fixing roads, bridges, airports, broadband and other infrastructure; legislation expanding treatment for veterans exposed to toxic burn pits; and an investment program to boost the nation’s semiconductor industry, all of which passed with Republican votes.

This is not a moment, however, in which bipartisanship is valued in the way it was when Mr. Biden came up through the Senate in the 1970s, 1980s and 1990s. His desire to position himself as the leader who can bring together a deeply divided country is at the heart of his case for a second term next year. But it conflicts with the interests of many Democrats who see more political benefit in standing firm against former President Donald J. Trump’s Republican Party and prefer to draw a sharper contrast for their own elections in 2024 when they hope to recapture the House.

“The agreement also represents a compromise that means no one got everything they want, but that’s the responsibility of governing,” Mr. Biden told reporters at the White House on Sunday evening.

Most importantly from Mr. Biden’s point of view, the agreement averts a catastrophic national default that could have cost many jobs, tanked the stock markets, jeopardized Social Security payments and sent the economy reeling. He is banking on the assumption that Americans will appreciate mature leadership that does not gamble with the nation’s economic health.

But many on the political left are aggravated that Mr. Biden in their view gave into Mr. McCarthy’s hostage-taking strategy. The president who said the debt ceiling was “not negotiable” ended up negotiating it after all to avoid a national default, barely even bothering with the fiction that talks over spending limits were somehow separate.

Liberals were pushing Mr. Biden to stiff the Republicans and short-circuit the debt ceiling altogether by claiming the power to ignore it under the 14th Amendment, which says the “validity of the public debt” of the federal government “shall not be questioned.” But while Mr. Biden agreed with the constitutional interpretation, he concluded it was too risky because the nation could still go into default while the issue was being litigated in the courts.

And so, much to the chagrin of his allies, the bargaining of recent weeks was entirely on Republican terms. While details were still emerging this weekend, the final agreement included no new Biden fiscal initiatives like higher taxes on the wealthy or expanded discounts for insulin. The question essentially was how much of the Limit, Save and Grow Act passed by House Republicans last month would the president accept in exchange for increasing the debt ceiling.

But Mr. Biden succeeded in stripping the Limit, Save and Grow Act significantly down from what it originally was, to the great consternation of conservative Republicans. Instead of raising the debt ceiling for less than one year while imposing hard caps on discretionary spending for 10 years, the agreement links the two so that the spending limits last just two years, the same as the debt ceiling increase. While Republicans insisted on predicating the limits on a baseline of 2022 spending levels, appropriations adjustments will make it effectively equivalent to the more favorable baseline of 2023.

As a result, the agreement will pare back anticipated spending over the decade just a fraction of what the Republicans sought. The Congressional Budget Office estimated that the caps passed by House Republicans last month would have trimmed $3.2 trillion in discretionary spending over 10 years; a rough New York Times calculation suggests the agreement reached by Mr. Biden and Mr. McCarthy might instead cut a third of that or less.

Moreover, while Mr. Biden did not advance many new Democratic policy goals in the agreement with Mr. McCarthy, he effectively shielded the bulk of his accomplishments from the first two years of his presidency from Republican efforts to gut them.

The Republican plan envisioned revoking many of the clean energy incentives that Mr. Biden included in the Inflation Reduction Act, eliminating additional funds for the Internal Revenue Service to chase wealthy tax cheats and blocking the president’s plan to forgive $400 billion in student loans for millions of Americans. None of that was in the final package.

Indeed, the I.R.S. provision offers an example of Mr. Biden’s deal-making. As a concession to Republicans, he agreed to cut around $10 billion a year for two years from the additional $80 billion previously allocated to the agency over the next decade, but most of that money will be used to avoid deeper cuts in discretionary spending sought by Republicans.

One of the touchiest areas for Mr. Biden’s progressive allies was the Republican insistence on imposing or expanding work requirements on recipients of social safety-net programs, including Medicaid, food assistance and welfare payments for families. Mr. Biden, who supported work requirements on welfare in the 1990s, initially signaled openness to considering the Republican proposals, only to face a fierce blowback from Democrats.

On Friday night, even as the deal was coming together, the White House issued a sharp statement accusing Republicans of trying to “take food out of the mouths of hungry Americans” while preserving tax cuts for the wealthy — a broadside aimed as much at reassuring restive liberals as assailing hard-line conservatives.

The final agreement between Mr. Biden and Mr. McCarthy includes no work requirements for Medicaid, but does raise the age for people who must work to receive food aid through the Supplemental Nutrition Assistance Program, or SNAP, to 54 while eliminating requirements for veterans and homeless people. The agreement moderates Republican provisions to expand work requirements for Temporary Assistance for Needy Families.

The challenge now for Mr. Biden is selling the compromise to his fellow Democrats. Just as Mr. McCarthy knows he will lose potentially dozens of Republicans disappointed in the accommodations he made, the president expects many in his own party to vote against the final product as well. But he needs to deliver enough Democrats to offset G.O.P. defections to forge a bipartisan majority.

Representative Jim Himes, Democrat of Connecticut, summed up the reaction of many in his party. “None of the things in the bill are Democratic priorities,” he said on “Fox News Sunday,” citing health care, climate change and other issues and adding that “those are priorities and not a single one of them are in this bill.”

But he added that Mr. Biden had pared down the final product. “The reason it may have some traction with some Democrats is that it’s a very small bill.”

Sensitive to the criticism, the White House sent briefing materials and talking points to every House Democrat within minutes of striking the deal on Saturday night and followed up on Sunday with telephone calls. In his short meeting with reporters later in the day, Mr. Biden rejected criticism from Democrats worried he gave away too much. “They’ll find I didn’t,” he said. As for concern that the work requirements would hurt those in need of food, he said, “It’s a ridiculous assertion.”

Mr. Biden has been here before. As vice president, he was President Barack Obama’s chief negotiator in several fiscal showdowns, but he so aggravated fellow Democrats who thought he gave away too much that Senator Harry M. Reid of Nevada, then the party leader in the Senate, effectively barred Mr. Biden in 2013 from negotiations over a debt ceiling increase.

Kicking a vice president out of the room, of course, is one thing. Mr. Biden is now the president and the leader of his party heading into a re-election year. It’s his room. And he is managing it on his own terms, like it or not.