Alphabet’s shares were up nearly 3% in pre-market trading.

The cuts come at a delicate moment for the U.S. company, which has long been the leader in key areas of AI research.

Alphabet now faces a challenge from Microsoft Corp (MSFT.O) in a branch of tech that can, for instance, create virtually any content a user can think up and type in a text box.

Microsoft this week said recession worries were forcing it to shed 10,000 jobs, less than 5% of its workforce, and it would focus on imbuing its products with more AI going forward — a point Alphabet’s CEO Sundar Pichai echoed in the memo.

Alphabet faced “a different economic reality” from the past two years when it rapidly expanded headcount, decisions for which Pichai said he took “full responsibility.”

Pichai became Alphabet CEO in 2019.

Still, he said, Google was gearing up “to share some entirely new experiences for users, developers and businesses,” and the company has “a substantial opportunity in front of us with AI across our products.”

It was unclear if Alphabet would take a one-time financial charge related to the job cuts. Microsoft’s severance packages, lease consolidation and hardware-lineup changes will cost it more than $1 billion, it said earlier this week.

Alphabet’s layoffs followed a review of its people and priorities, leading to a workforce reduction hitting various geographies, Pichai said. Among those losing their jobs are recruiters, corporate staff and people working on engineering and product teams, he added.

In the United States, where Alphabet has already emailed affected employees, staff would receive severance and six months of healthcare as well as immigration support.

Overseas, layoff notifications will take longer due to local employment laws and practices, Pichai said in the memo.