Google agreed to invest up to $2 billion in Anthropic, building on its earlier investment in the artificial-intelligence company and adding fuel to the race between startups trying to achieve the next big breakthrough in the emerging technology.

Google invested $500 million upfront into the OpenAI rival and agreed to add $1.5 billion more over time, people familiar with the matter said.