For all their creativity, high-tech companies are still working out how to be both smart and good.

The tech industry’s unrelenting sexism drew the book treatment in Emily Chang’s bestselling “Brotopia: Breaking Up the Boy’s Club in Silicon Valley” early this year and stayed in the headlines. Just last week, one of the industry’s biggest companies, Google, announced new policies after revelations and protests over giant payouts to male executives ousted amid sexual harassment claims.

Tech firms’ harvesting and abuse of personal data led to strict new rules in the European Union, the public upbraiding of CEOs before congressional committees and, last week, a hilarious takedown of by comedian Hasan Minhaj on his Netflix show “Patriot Act.”

One of the most powerful journalists covering the industry, Kara Swisher, called last month for tech companies to hire “chief ethics officers” after so many have recently been swept up in scandals — from manipulating regulators, mistreating shareholders and losing customers’ data to becoming dependent on investments from Saudi Arabia.

For Lucie Greene, the director of the innovation group at media agency J. Walter Thompson, this reckoning springs from ambition colliding with boundless capital and has been building for years. At a tech conference in 2014, she noticed that several of Silicon Valley’s biggest names were talking less about their companies and more about changing society.

“It seemed to me like the ambition of the brands had gotten much, much bigger,” Greene said. “These companies had much bigger civic claims. You saw Facebook talking about schools and transport systems, white papers coming from Uber.”

Greene started thinking about what the world would be like if it was designed by Silicon Valley techies. She put down the result of those thoughts and her research in a new book called “Silicon States: The Power and Politics of Big Tech and What It Means For Our Future.”

Her chief conclusion: Unlike government, which spends money on everyone and works in places no one else will go, tech companies are driven by profit first.

“Even if they’re using economies of scale to make something more affordable, everything that they produce, whatever the altruistic rhetoric, has a commercial end,” Greene said during a recent visit to Minneapolis. “It’s always an 80-percent solution from tech. It’s not a 100-percent solution.”

Many of the conflicts making headlines in the tech industry today spring from executives deciding to place more importance on convenience than fairness. Greene cites numerous examples in her book. Airbnb boasts of democratizing travel, but travelers have encountered biases from property owners about who is allowed to rent. Amazon builds out a delivery system that rivals the postal service but excludes lower-income urban neighborhoods. Uber creates a ride-sharing service that, in giving passengers power to rate drivers and affect pay, puts women drivers at greater risk than men.

“These services are consumer-centric,” Greene said. “But thanks to the funding system in Silicon Valley, they don’t necessarily need to be profitable. And they’re able to scale and unseat businesses that do have to pay taxes, that have to comply with regulations, that have to pay severance and maternity leave.”

Even as she criticizes the reach and power of the nation’s biggest tech firms, Greene calls herself a “complete hypocrite,” saying she uses Amazon and Uber frequently. Minhaj made a similar observation in his criticism of Amazon, saying on his Netflix show that he is addicted to the convenience of its Prime Now two-hour delivery service.

“I am not the only one who is hooked,” Minhaj said. “Advertisers are hooked on Amazon’s data. Vendors are hooked on its customers. Politicians are hooked on its jobs. Companies are hooked on its servers. And Wall Street is hooked on its stock price.”

But the trade-off of from all that, Greene said, is “disconnection from collective community and civic purpose and spirit.”

Until recently, tech executives tamped down such criticism. When scholars and others raised concerns about data protection and privacy in the past, Greene noted the typical response from a tech executive was “You don’t believe in internet freedom, do you?” or “Do you want to stop innovation?” “Tech companies have employed very polarized rhetoric to sidestep meaningful dialogue or criticism,” Greene said.

A few signs are emerging that tech firms are feeling the pushback. A French company called Snips is advertising a home-automation system that, in contrast to other innovators, doesn’t collect information about how or when customers use it.

Addressing the prospect of restrictions on data collection and use, Amazon CEO Jeff Bezos said earlier this year the company should expect to be regulated and will “work with any set of regulations we are given.” And in a speech at a privacy conference in Brussels last month, Apple CEO Tim Cook declared that personal data was being “weaponized” against individuals and the greater good.

“This crisis is real. It is not imagined, or exaggerated, or crazy. And those of us who believe in technology’s potential for good must not shrink from this moment,” Cook said.

Then, there’s the other extreme. In China, tech firms are working with the government to create a “social credit” system that monitors whether people spend wisely and how they behave in public areas.

“We’re 20 years into mass use of the internet and 15 years into social media,” Greene said. “I think you are really starting to see people question what we’ve inherited.”