The S&P 500 is down 12% from its all-time high, putting it not all that far from bull market territory, at least by the most conservative definition. The benchmark index returned an average of 285% during the last five bull markets, and many stocks should soar during the next one.

Investors hoping to capitalize on that inevitable upswing should consider building a basket of artificial intelligence (AI) stocks. Advancements in AI promise to add trillions of dollars to the global economy, making it a major driver of the next bull market.

Here are two AI stocks with monster growth potential.

1. The Trade Desk

The Trade Desk (TTD 1.67%) operates the leading independent demand-side platform in the ad tech industry. Its software helps media buyers create, measure, and optimize data-driven ad campaigns across digital channels like desktop, mobile, and connected TV.

As an independent ad tech company (meaning it does not own media content), The Trade Desk avoids the conflicts of interest that have landed peers like Alphabet in the crosshairs of antitrust regulators.

Specifically, Alphabet operates as a publisher, supply-side platform, and demand-side platform, participating on both sides of ad transactions and competing against its own customers. That opaque business model creates several problems, one being that publishers are reluctant to share data because Alphabet will use it to sell its own inventory from Google Search and YouTube.

But publishers have no such reservations about The Trade Desk because it does not compete against its customers, making its business model far more transparent.

That advantage has enabled it to build the most advanced data marketplace in the industry, empowering media buyers to measure and optimize campaigns unlike any other platform. But data is also the foundation of AI, and CEO Jeff Green says the company offers industry-leading AI due to its "very robust and very unique data set." That further empowers media buyers to optimize campaign performance.

The Trade Desk reported impressive results in the second quarter, with revenue up 23% to $464 million, easily topping the 3% ad revenue growth reported by Alphabet.

Net income under generally accepted accounting principles (GAAP) improved to $33 million, up from a loss of $33 million in the prior year. That relative outperformance means The Trade Desk is gaining market share quickly, and the company is well positioned to maintain that momentum.

Morgan Stanley ranks it as one of 11 companies uniquely positioned to benefit from AI, and Morningstar expects it to grow revenue at 22% annually over the next five years, outpacing the broader ad tech industry. That makes its valuation of nearly 22 times sales seem a bit more reasonable. Risk-tolerant investors should start with a small position in this growth stock, then add to it during pullbacks.

2. Datadog

Datadog (DDOG 4.95%) provides observability and cybersecurity software to development, operations, and security teams. Its platform integrates data from across the corporate technology stack to provide real-time visibility into business-crucial applications and infrastructure. The company unifies nearly two dozen software modules, and it leans on AI to automate anomaly detection and root-cause analysis, thereby speeding up remediation of problems.

Analysts have regularly praised Datadog for its broad functionality and powerful AI, and the company is a recognized leader in AI for information-technology operations, application-performance monitoring, and log monitoring. But Datadog also has a strong presence in other observability-software verticals, including server monitoring, cloud-infrastructure monitoring, and database monitoring.

Datadog reported solid results in the second quarter, with its customer count increasing 23% to 26,100, and the average customer spent north of 20% more. Revenue increased 25% to $510 million, and adjusted net income climbed 50% to $125 million. Investors have good reason to think that momentum will persist.

The company has developed new products at a remarkable pace. Datadog became the first company to combine infrastructure monitoring, application monitoring, and log management on a single platform in 2018. It then offered network monitoring in 2019, cloud security in 2020, database monitoring in 2021, and cloud service monitoring in 2022.

Datadog branched into large-language model monitoring in 2023, which positions the company as a key beneficiary of the generative AI boom. The company's capacity for innovation should keep it on the leading edge of observability software, a market that management values at $62 billion in 2026.

Morningstar expects Datadog to grow revenue at 31% annually over the next five years, making its current valuation of nearly 15 times sales look more reasonable. Investors should feel confident in buying a small position in this growth stock today.