The House was already well on its way to passing a crucial budget agreement Thursday when Speaker Nancy Pelosi pulled aside Majority Leader Steny H. Hoyer in a hallway outside the chamber.

Democrats had already cast 216 votes for the bill, Pelosi told Hoyer. But two more votes would send a message: that the party was so united, it could pass a compromise negotiated with President Trump and Republicans with an absolute majority of the House.

Moments after Hoyer walked onto the floor, three more Democrats voted for the bill — including two members of the liberal “Squad” of newly elected women — vividly demonstrating that despite the frequent turmoil in their ranks, Pelosi and her leadership team stand in firm control of House Democrats.

Pelosi (D-Calif.) told reporters afterward that she wanted to make a statement about her caucus’s unity, and at a news conference Friday, she held forth on her leadership of a rambunctious group.

House Speaker Nancy Pelosi (D-Calif.) sought to minimize tensions between her and four liberal minority congresswomen known as “the Squad.” (Reuters)

“I consider myself a weaver,” she said, “just at the loom just making all of those threads come together in the boldest possible way.”

Democrats began the month in a shambles after a late-June vote on a border bill left wings of the party in open warfare, with internally divisive votes looming on military policy, a minimum-wage increase and Israel, among other issues. Pelosi and the young leftists, meanwhile, publicly sniped, deepening the sense of disarray.

A month later, Democrats left for a six-week summer recess on remarkably better footing, having easily passed key pieces of their legislative agenda — plus the surprise budget accord that, in a major Democratic win, secured an additional $149 billion in domestic spending over the next two years.

Democratic presidential candidates have increased their calls to begin impeachment proceedings against President Trump following Mueller's July 24 testimonies. (The Washington Post)

And in a gesture of amity, Pelosi met Friday with Rep. Alexandria Ocasio-Cortez (D-N.Y.), who weeks earlier criticized the speaker for “explicit singling out of newly elected women of color.”

“It’s like you’re in a family,” Pelosi said at a news conference afterward. “In a family, you have your differences, but you’re still a family.”

The party is still bitterly divided over impeaching Trump. But testimony this week from former special counsel Robert S. Mueller III did not fundamentally change Pelosi’s approach to the matter. While more than 100 Democrats now publicly support a formal impeachment inquiry and members of the House Judiciary Committee took steps in that direction Friday — including filing a court petition to unseal some of Mueller’s evidence — there is no sign she is facing a serious rebellion to her deliberate approach.

In fact, Pelosi signed off on the committee’s legal petition.

“People tend to seem, to me, to feel that unless you are unanimous, you can’t be united. You know, we aren’t a unanimous party,” House Majority Whip James E. Clyburn (D-S.C.) said as he left the budget vote Thursday. “Good dissent gives us all something to keep us on our toes and something to really think about. But this party is united.”

At crucial points throughout the month, different wings of the party retreated from potential political land mines.

The annual defense policy bill was a test for the party’s left wing as it authorized $733 billion in Pentagon spending — tens of billions more than liberals wanted to accept. But House leaders, along with Armed Services Committee Chairman Adam Smith (D-Wash.), attached an array of liberal amendments that allowed the bill to pass July 12 almost entirely with Democratic votes.

The following week, it was moderates who had to swallow their objections. The July 18 passage of the Raise the Wage Act is intended to fulfill organized labor’s long-standing goal of setting a $15 minimum wage. But many centrists, particularly from states with low costs of living, believe that would harm small businesses in their districts and argued for a regionally adjusted approach. House leaders agreed to stretch out the new wage’s implementation by a year, to 2025, and to conduct a study on job impacts but otherwise held firm.

Rep. Terri A. Sewell (D-Ala.), who had strenuously argued for the regional model, said she preferred her own bill. “But at the end of the day, this is a democratic process, and this is the bill that’s moving.”

And this week, the House quickly brushed past another potential political grenade, passing a measure condemning a global boycott targeting Israel on an overwhelming 398-to-17 vote — months after accusations of anti-Semitism inflamed tensions and made many Democrats wary of even broaching the subject of Israel. Leaders, meanwhile, moved forward on a bill to set detention standards at Border Patrol facilities while holding off on a more aggressive bill to constrain Trump’s policies.

“Yes, Democrats, we have robust discussions. The Republicans have robust discussions,” Hoyer (D-Md.) said Thursday, reflecting on the month. “But when we come down to it, we are a unified party.”

Meanwhile, the brewing internal tension between Pelosi and the Squad was all but extinguished with a single tweet from Trump.

When he told the four women — Reps. Ilhan Omar (D-Minn.), Ayanna Pressley (D-Mass.), Rashida Tlaib (D-Mich.) and Ocasio-Cortez — “go back” to the “totally broken and crime infested places from which they came” on July 14, Pelosi was among the very first to leap to their defense before Democrats of all stripes rallied behind them.

Seeking to defuse some of the us-vs.-them dimensions of the conflict, Clyburn pointed out Thursday that the four women split on the budget bill: Omar and Pressley opposed it, while Ocasio-Cortez and Tlaib supported it.

“They aren’t monolithic,” he said. “I mean, they have their differences, and we all have our differences.”

After their meeting Friday, Pelosi and Ocasio-Cortez both played down its significance. “As always, I think the speaker respects the fact that we’re coming together as a party and a community,” Ocasio-Cortez said, while Pelosi, asked if they had buried the hatchet, said, “I don’t think there ever was any hatchet.”

But others, like House Oversight and Reform Committee Chairman Elijah E. Cummings (D-Md.), were eager to cast the meeting as a fresh start: “She’s moving forward. I know the speaker is, too,” he said.

Looking ahead to the fall, new challenges await. The budget deal paves the way for passage of the spending bills that fund individual federal agencies and programs, but it doesn’t guarantee it. Appropriators will spend the coming months hashing out those bills, which could end up in renewed loggerheads over Trump’s border wall, abortion-related issues, lawmaker pay raises or other pitfalls.

House leaders are also hoping to move bills on infrastructure, community health centers and other policy matters. Legislation aimed at lowering prescription drug prices could be particularly tricky for Pelosi — largely because it is one area where Democrats believe they could compromise with Trump and congressional Republicans.

Wendell Primus, Pelosi’s top health-care adviser, said at a Brookings Institution event Monday that the drug pricing bill would be unveiled shortly after Congress reconvenes in September in hopes of passing it before the end of the year. Underscoring the political risks, he said, House leaders decided to wait until after the recess, in part to avoid the sort of public backlash that greeted Affordable Care Act supporters in the summer of 2009.

“I’m not saying that would happen again exactly like that, but there is no doubt in my mind that [the pharmaceutical industry] will argue very hard against drug negotiation of the kind we’re talking about,” Primus said.

He left no question, however, that Pelosi intended to act — even if it means compromising with Trump: “I have no doubt that the person that I work for really wants to lower drug prices for the American people.”

But the biggest fault line will remain whether to pursue Trump’s impeachment. That sentiment could be inflated or deflated as lawmakers return to their districts and interact with constituents.

Key lawmakers and strategists consulted this week see little sign of a massive uproar around impeachment like those surrounding health care in the summers of 2009 and 2017. Still, some have pointed to pending litigation that could produce key Trump-related financial documents in the coming months, sparking the push.

But Pelosi, speaking to reporters Friday, made clear that she remained in control: “We will proceed when we have what we need to proceed, not one day sooner,” she said, adding that lawmakers have “the liberty and the luxury to espouse their own position, and to criticize me” for taking a careful approach. “I’m willing to take whatever heat there is.”

Rachael Bade and Paul Kane contributed to this report.