Artificial intelligence (AI) has been one of the hottest trends in the technology sector over the past couple of years, and that's not surprising as this disruptive technology has been positively impacting multiple companies across several industries.

McKinsey and Company pointed out last year that generative AI has the potential to add between $2.6 trillion and $4.4 trillion to the global economy by boosting productivity in sectors such as banking, retail, marketing, and factory automation. That's why buying and holding solid AI companies for a long time to come could help investors get richer.

Such a strategy will not just allow investors to take advantage of the fast-growing adoption of AI, but also benefit from the power of compounding that could help them increase the value of their investments substantially. As a result, investors looking to construct a diversified million-dollar portfolio can consider buying AI stocks such as Palo Alto Networks (PANW -1.23%) and C3.ai (AI -4.26%), two companies that are set to capitalize on multibillion-dollar AI-related opportunities.

Let's look at the reasons why these two names could be ideal buys for investors aiming to become millionaires in the long run.

1. Palo Alto Networks

The cybersecurity industry has been adopting AI-focused tools for a long time to help organizations shore up their defenses against bad actors. From generative AI assistants that help security analysts save time while performing tasks such as scanning alerts, to automating the process of threat detection and prevention, to analyzing code and finding potential vulnerabilities, cybersecurity companies such as Palo Alto Networks have been offering multiple tools to their customers.

Morgan Stanley points out that the demand for AI cybersecurity tools could grow to $135 billion a year in 2030 from just $15 billion in 2021. Not surprisingly, cybersecurity specialists such as Palo Alto have been busy integrating AI-enabled tools into their offerings so that they can win more business. On its latest earnings conference call, Palo Alto management pointed out that its platform secures "over 750 AI applications, a volume which we believe leads the industry, and are growing this figure by the day."

The company also points out that its annual recurring revenue (ARR) from AI-related offerings stood at $250 million in the first quarter of fiscal 2025 (which ended on Oct. 31). It won't be surprising to see this figure moving higher in the long run considering the huge addressable opportunity on offer in the AI cybersecurity market, as well as the fact that Palo Alto is looking to push the envelope further.

For instance, Palo Alto added over 400 machine learning modules to its AI platform last quarter to improve the autonomous capabilities of its security operations center. Such moves explain why the company has been steadily building a robust revenue pipeline that should allow it to sustain healthy growth levels.

Palo Alto ended fiscal Q1 with remaining performance obligations (RPOs) of $12.6 billion. This metric, which refers to the total value of a company's contracts that will be fulfilled in the future, increased by an impressive 20% year over year. That was better than the 14% year-over-year growth in the company's revenue last quarter to $2.1 billion.

The good part is that Palo Alto expects its RPO to increase between 19% and 20% for the full year to a range of $15.2 billion to $15.3 billion. That would be higher than the 14% revenue growth that the company is forecasting for the full year to a range of $9.12 billion to $9.17 billion. Also, the healthy RPO metric suggests why analysts are anticipating a slight acceleration in Palo Alto's growth over the next couple of fiscal years.

PANW Revenue Estimates for Current Fiscal Year Chart

PANW Revenue Estimates for Current Fiscal Year data by YCharts

The company's improving top-line growth is expected to translate into stronger bottom-line growth as well. This is evident from the following chart, which points toward an acceleration in earnings growth in a couple of years.

PANW EPS Estimates for Current Fiscal Year Chart

PANW EPS Estimates for Current Fiscal Year data by YCharts

Given that AI presents a secular growth opportunity for cybersecurity companies, Palo Alto seems to be in a solid position to maintain its impressive growth over the long run. As such, it won't be surprising to see this stock deliver healthy gains to investors in the future, which is why it seems like an ideal pick for investors looking to make a million-dollar portfolio.

2. C3.ai

C3.ai is an enterprise AI software company that provides more than 100 AI applications to customers across multiple industries ranging from financial services to manufacturing, to oil and gas, to chemicals and many more. Additionally, C3.ai also offers an application development platform that customers can use to develop custom applications based on their needs.

The company, therefore, operates in a massive market. Market research firm IDC predicts that the AI software market could generate a massive $251 billion in revenue in 2027 compared to just $64 billion in 2022, clocking an annual growth rate of more than 31%. C3.ai's results indicate that it is well on its way to making the most of this impressive opportunity.

The company's revenue in the second quarter of fiscal 2025, ended Oct. 31, was up 29% year over year to $94.3 million. That was a nice improvement over the 17% growth that C3.ai clocked in the same period last year, as well as the 21% year-over-year increase in revenue in fiscal Q1. The strong demand for C3.ai's enterprise AI software is also evident from the fact that existing customers have increased the adoption of its offerings, while the company is also getting new customers into its fold.

C3.ai struck 58 agreements last quarter, including big names such as ExxonMobil, Rolls-Royce, Mars, and several government agencies as customers. The fact that C3.ai has increased its full-year revenue guidance to $388 million from the earlier expectation of $382.5 million suggests that the new customers and the increased spending will drive stronger growth for the company.

The updated guidance indicates that C3.ai's revenue could increase by 25% in the current fiscal year. Even better, analysts have raised their growth expectations from C3.ai for the next couple of years as well following its latest quarterly report.

AI Revenue Estimates for Current Fiscal Year Chart

AI Revenue Estimates for Current Fiscal Year data by YCharts

However, there is a good chance that C3.ai could continue exceeding expectations thanks to the size of the AI software market and its solid customer base. The market could reward C3.ai stock handsomely in such a scenario, which is why investors looking to add a growth stock to their portfolios that could help them become millionaires in the long run can consider buying this AI software specialist.