Artificial intelligence (AI) has emerged as a burning hot investment theme in 2023. Although this transformative technology has been in development for decades, its huge investment potential has now become all too apparent.

Nevertheless, investors must exercise caution in managing their risks when participating in this long-term trend. Hence, instead of opting for stocks with unproven AI-based products and services, investors should consider smaller stakes in tech titans such as Tesla (TSLA 15.31%) and Amazon (AMZN 0.75%). Both of these companies have made major strides in their AI ambitions and have deep pockets to fund future research and development for AI initiatives.

Here's why I believe that these two companies are well positioned to cross the $2 trillion market capitalization milestone by 2030.

1. Tesla

Tesla's recent third-quarter earnings report disappointed some investors due to vehicle delivery issues, competition, and profit margin challenges. CEO Elon Musk, however, remains confident that the company's AI initiatives such as robotaxis, full self-driving (FDS) technology, the Optimus humanoid robot, and supercomputing can eventually make it the most valuable company in the world.

Musk expects the superior economics of fully autonomous vehicles -- which can lead to a 5x increase in utilization rates as compared to current levels -- to emerge as a major competitive edge for Tesla.

The company unveiled the Dojo supercomputer in 2021, which is expected to eventually provide the computing power required to train AI models and chips driving FSD technology in every Tesla vehicle. With FSD beta vehicles having posted over 500 million miles, Tesla seems well positioned to capture a significant share of this global opportunity, which is estimated to grow from $33.5 billion in 2023 to $93.3 billion in 2028.

Morgan Stanley analysts expect the Dojo supercomputer to push Tesla's market value by nearly $600 billion, by speeding up the company's advances in the robotaxi and software businesses. Analysts also expect Dojo to open new avenues for Tesla beyond autonomous vehicles.

Tesla is also leveraging its AI capabilities in Optimus humanoid robots -- wherein robots can learn tasks by observing (instead of extensive programming) as well as manufacture other robots. With the global humanoid robot market projected to grow from $1.8 billion in 2023 to $13.8 billion in 2028, the company's AI initiatives have positioned it to disrupt a multibillion-dollar industry.

Tesla's energy-storage business is another major bright spot and is fast becoming the highest-margin business for the company.

Tesla is currently trading at a price-to-sales multiple (P/S) of 7.5, which is far lower than the company's five-year median P/S multiple of 9.6. Analysts are projecting the company's revenue to be $344.5 billion in fiscal 2030, more than 3 times its fiscal 2023 anticipated revenue of $97.33 billion.

Assuming that the long-term P/S multiple remains mostly unchanged (despite it being far lower than the past five-year median multiple), Tesla's market cap can reach around $2.3 trillion by 2030.

Hence, for those investors who see the company more as a tech powerhouse and AI company than just an automaker, the long-term thesis looks quite attractive despite the short-term setback.

2. Amazon

After a period of slower growth in 2022, Amazon seems to finally be back in the growth mode. The company's revenue was up by 13% year over year to $143 billion in the third quarter, while operating profit also soared year over year by a whopping 348% to $11.2 billion.

The remarkable performance in the face of ongoing macroeconomic uncertainties shows the strength of Amazon Web Services' (AWS) cloud-computing business and the U.S. e-commerce business.

While AWS witnessed a deceleration in the past few quarters, revenue seems to be stabilizing in the third quarter. CEO Andy Jassy has highlighted confidence for the cloud business from the fourth quarter of 2023 and beyond, as the cost optimization efforts by cloud customers appear to be nearing an end.

Besides existing customers deploying new workloads, the company is also seeing increasing pace and volume of closed deals from new customers. The company's Amazon Bedrock service further empowers AWS customers to build customized generative AI applications using proprietary data or existing AI models.

Amazon's e-commerce business is also showing signs of improvement. The company's strategy, (which involves simplifying the delivery network, consolidating orders, increasing the number of fulfillment centers, and optimizing inventory) is helping lower costs and reduce delivery times.

Amazon is also leveraging generative AI capabilities for improving product discovery from online stores, inventory forecasts, and optimal last-mile transportation routes -- to further boost the efficiency of its e-commerce business.

Amazon is currently trading at a P/S multiple of 2.45, which is far lower than the company's five-year median P/S multiple of 3.5. Analysts are projecting the company's revenue to be $1.15 trillion in 2030, nearly twice its 2023 anticipated revenue of $570.3 billion.

Assuming that the long-term P/S multiple remains mostly unchanged, Amazon's market cap can easily reach around $2.3 trillion by 2030.

With Amazon's core businesses thriving and AI initiatives bearing fruit, investors can look forward to an impressive run in share prices by 2030.