Roughly 30 years ago, the advent of the internet ushered in a new era of corporate growth. Although it took many years for the internet to mature a technology and for businesses to figure out how to optimize this innovation to boost their sales and profits, it was a genuine game-changer.

For decades, Wall Street and investors have been waiting for the next technological leap forward. The evolution of artificial intelligence (AI) looks to have answered the call.

AI empowers software and systems with the ability to make split-second decisions, all without the need for human oversight. AI-accelerated data centers are facilitating generative AI solutions for businesses, as well as helping to train large language models (LLMs), such as chatbots and virtual agents.

Silver dice that say buy and sell being rolled across a digital screen displaying stock charts and volume data.

Image source: Getty Images.

Based on estimates in Sizing the Prize, the analysts at PwC foresee AI adding $15.7 trillion to the global economy by 2030. If this projection is even remotely close to accurate, it's going to lead to a lot of winners. But it doesn't automatically mean every AI stock is worth buying.

As we push into the second-half of 2025, two historically cheap artificial intelligence stocks are begging to be bought, while another AI highflier with mounting red flags is worth avoiding in July.

Magnificent AI stock No. 1 that can be purchased with confidence in July: Alphabet

Although the "Magnificent Seven" played an undeniably huge role in lifting Wall Street's major stock indexes to new highs, one of its seven components remains historically inexpensive. I'm talking about Google parent Alphabet (GOOGL 0.54%) (GOOG 0.51%).

While there's been some concern about the possibility of LLMs siphoning away internet search share from Google, we haven't witnessed any evidence of this occurring. Based on data from GlobalStats, Google accounted for a monopoly like 89.6% of global internet search market share in May 2025. Looking back more than a decade, it's consistently accounted for an 89% to 93% worldwide share of internet search. This is a foundational cash cow of a segment that's not going away.

Don't overlook Alphabet's strong cyclical ties, either. Approximately 74% of its net sales during the March-ended quarter can be traced to advertising, which includes ads found on YouTube, the No. 2 most-visited social media destination. With economic expansions lasting considerably longer than recessions, Alphabet is ideally positioned to take advantage of long-winded periods of growth and often possesses exceptional ad-pricing power.

However, Alphabet's most attractive long-term growth prospect is its cloud infrastructure service platform, Google Cloud, which is already pacing more than $49 billion in annual run-rate revenue. Google Cloud is the world's No. 3 cloud infrastructure service platform by spending, according to an analysis from Canalys, and its sales have the potential to accelerate further with customers gaining access to generative AI solutions.

As promised, there's also quite the value proposition with shares of Alphabet. As of the closing bell on June 27, shares of the company can be scooped up for 12.7 times forecast cash flow in 2026, as well as a forward price-to-earnings (P/E) multiple of 17.5. For context, this represents a 28% discount to its average multiple to cash flow over the trailing-five-year period and is 20% below its average forward P/E ratio since 2020.

A hacker wearing a hooded sweatshirt who's typing on a keyboard in a dimly-lit room.

Image source: Getty Images.

Sensational AI stock No. 2 that can be bought in July: Okta

The second inexpensive artificial intelligence stock that makes for a no-brainer buy in July is none other than cybersecurity company Okta (OKTA 0.98%). While shares hit the skids in late May after the company guided for "just" 9% to 10% full-year sales growth in fiscal 2026 (ended Jan. 31, 2026), there are multiple reasons to believe Okta's growth story is just getting started.

To begin with, cybersecurity has evolved from an optional to necessary solution for businesses. Regardless of how well or poorly the U.S. economy and stock market are performing, hackers don't take time off from trying to steal sensitive data. This means demand for cybersecurity solutions from third-party providers like Okta is only going to increase.

What makes Okta such an intriguing investment is its AI- and machine learning-driven identity verification platform. Though AI platforms aren't perfect, they offer the ability to become smarter over time at recognizing and responding to potential threats. This should make Okta's Identity Cloud platform far nimbler and more effective than on-premises solutions.

Something else working in Okta's favor is its subscription-based operating model. Subscription-fueled models tend to offer high margins (often in the neighborhood of 80%) and keep customers loyal to the platform. Additionally, it provides a layer of operating cash flow predictability that Wall Street and investors tend to appreciate.

Okta's valuation also makes sense -- especially following its double-digit percentage decline in late May. The company's forward P/E ratio has fallen to 27, and its forward-year cash flow multiple of 21 is well below its average cash flow multiple of 51 over the last half-decade.

The exceptionally pricey AI stock to avoid in July: Palantir Technologies

However, not every artificial intelligence stock can be a winner. Despite adding north of $300 billion in market cap over the last 30 months, data-mining special Palantir Technologies (PLTR 1.62%) is the AI stock investors should steer clear of in July.

Don't get me wrong, Palantir is a rock-solid business. Its government-focused Gotham platform and enterprise-driven Foundry platform have no one-for-one large-scale replacements, which means the company has a sustainable moat. These platforms, which respectively incorporate AI and machine learning, also generate highly predictable operating cash flow. Gotham's government contracts are spread over multiple years, while Foundry is a subscription-based model.

The problem is there's only so much premium that can be bestowed on a company with a sustainable moat, and Palantir has unquestionably overstepped its bounds. Whereas companies on the leading edge of the innovative curve during the rise of the internet topped out at price-to-sales (P/S) ratios of 30 to 43, Palantir's P/S ratio handily surpassed 110 last week. No megacap company has ever been able to sustain a multiple this aggressive for an extended period, and it's unlikely that Palantir is the exception.

Furthermore, there hasn't been a next-big-thing technology or innovation since (and including) the advent of the internet that avoided a bubble-bursting event. In other words, investors have persistently overestimated the early adoption and/or utility of game-changing technologies for three decades.

Though spending on AI infrastructure has been robust, the simple fact that most businesses aren't optimizing this technology as of yet, or generating a profit on their AI investments, signals the growing likelihood of being in a bubble. If the AI bubble bursts, investor sentiment will weigh heavily on the exceptionally expensive Palantir.

Lastly, the long-term ceiling for Gotham (the company's most-profitable segment) is lower than investors might realize. Since this AI-driven platform is only available to the U.S. and its immediate allies, Palantir's customer pool is rather narrow. It's all the more reason for investors to avoid Palantir Technologies stock in July.