Assembly Speaker Carl Heastie in a commencement speech at Baruch College in Brooklyn on Monday urged graduate to resurrect the the “lost art” of civility in public life.

In the speech, Heastie cited his own struggles with politics and policy in Albany, pointing to the Democratic majorities in the state Senate and Assembly for the first time in a decade offering opportunities to progressives — but also pitfalls if they don’t acknowledge the differences within the party’s big tent.

“We are in a great position to build on the progress we have made,” he said. “But while my fellow Democrats and I share many of the same values, from the shores of the Great Lakes to the coasts of Long Island, each member of the legislature has a different life experience and represents a community with unique needs and interests. Simply put – we will not all be in complete agreement all of the time. Affecting real change requires open dialogue.”

A case study, he pointed to the criminal justice push this year to end cash bail. Ultimately, the final agreement was a compromise, keeping bail for violent felonies.

“Did everyone get everything they wanted? No. New Yorkers don’t care if legislators get what they want,” he said. “They care about whether or not they get what they need. In the last four years, I have accomplished a lot as a leader not because I stood my ground, but because I never stopped talking to those I disagree with.”

Heastie’s Democratic majority of 100-plus members can make life complicated, even with a large cushion, given the political imperatives and needs for a very large and complicated state.

And, after progressive advocates notched primary victories against incumbent Democrats in the state Senate last year, the expectation is that some Assembly lawmakers will face challenges next June.

Heastie, in so many words, urged caution against that, noting former President Barack Obama warned against a “circular firing squad” in a recent speech.

“During his speech, President Obama pointed out that our system doesn’t work if you don’t compromise on anything or you compromise on everything,” he said. “Instead, you must know what your core principles are and stay true to them.”