Artificial intelligence (AI) represents a huge opportunity for companies and investors as it grows into a roughly $1.4 trillion market by 2029, a massive increase from its $387 billion size right now. 

To successfully tap into AI, there are three top companies that are worth buying right now: The Trade Desk (TTD 4.02%), Amazon (AMZN -1.30%), and Nvidia (NVDA -1.86%). Here's why. 

A microchip on a logic board.

Image source: Getty Images.

1. The Trade Desk is advancing the ad market with AI

If you're not familiar with The Trade Desk, the company has an ad platform that helps companies buy ads on the internet, television platforms, and mobile apps. 

The Trade Desk's AI angle comes from the company using algorithms and artificial intelligence to automate what types of ads are displayed at different places online, making ad buying and placement easier and more efficient for its customers. 

Even in the fickle ad market, The Trade Desk's business is booming. Sales spiked 31% in the third quarter (ending on Sept. 30) to $395 million and non-GAAP (adjusted) earnings rose 44% to $0.26 per share. 

The quarter was impressive enough on its own, but it also came at a time other companies in the ad space experienced declining ad sales

The Trade Desk's resilience shows that this company knows how to successfully tap into the growing digital ad space, which will be worth an estimated $315 billion by 2025.  

While The Trade Desk's current price-to-sales (P/S) ratio of about 16 isn't exactly cheap, it's still far less expensive than its P/S ratio of about 40 this time last year. 

2. Amazon is an AI powerhouse

Some investors may not be aware that Amazon integrates AI into many aspects of its company. Amazon's algorithms help recommend deals and products to online shoppers on the company's massive e-commerce store, and help the company optimize its complex delivery network. 

AI is also on full display at the company's Amazon Go stores, where machine learning (through cameras, sensors, and algorithms) keeps track of the products people put in their baskets and automatically charges them when they walk out of the store

Additionally, Amazon Web Services (AWS) -- the company's cloud-computing business -- offers AI services to its customers for everything from text-to-speech applications to online chatbots.  

Amazon's share price has slid along with the broader tech sector over the past year, as macroeconomic headwinds put some pressure on the company. But long-term investors shouldn't overlook the company's current growth, including Amazon's total sales increasing in the third quarter (ending on Sept. 30) by 15% to $127.1 billion and AWS revenue jumping 27% to $20.5 billion. 

Amazon is using AI to take the lead in e-commerce and cloud computing, and the company's share price is currently looking pretty cheap. Amazon's shares trade at just 1.8 times the company's sales, down from a P/S ratio of 3.9 at this time last year. 

3. Nvidia's chips are leading the AI revolution

Behind all of the whiz-bang AI technologies, there are physical microchips making artificial intelligence a reality. And for many companies, their go-to AI processors are made by Nvidia. 

Nvidia's processors have proved rather adept at AI tasks, and the company's data center sales have expanded as a result. Nvidia's data center revenue increased 31% in the most recent quarter to $3.8 billion.  

While Nvidia faced some headwinds with some of its other businesses, data center growth continues to expand as the company's processors tap into the massive AI chip market, which will be worth an estimated $195 billion by 2030. 

In addition to its AI opportunities in data centers, Nvidia is also helping automakers create smarter vehicles with more semi-autonomous driving capabilities. The company's chips are helping power the next generation of driver-assistance systems and helping the company grab yet another AI market

With Nvidia's shares trading at about 68 times the company's earnings, Nvidia's stock isn't exactly cheap right now. But it is lower than the 100 price-to-earnings (P/E) ratio that the stock was trading at this time last year. 

Play the long AI game

Tech stocks are a bit frantic right now, and more short-term instability could be ahead as investors try to figure out how the U.S. economy is performing and where inflation is going.

Those are real concerns, but they shouldn't worry long-term investors. Instead, investors should be looking for opportunities in the market right now -- including in tech -- and investing in great companies with competitive advantages. 

Nvidia, Amazon, and The Trade Desk have all proved that they have a unique angle in the AI space, and their share price dips over the past year could be a good buying opportunity for those looking to start an AI position.