The concept of artificial intelligence (AI) has been around for thousands of years. In fact, Leonardo da Vinci constructed an automaton in 1495, building on work done centuries earlier by the philosopher Plato. But AI has evolved more rapidly in recent decades due to innovations in semiconductor design, and demand for AI solutions is expected to soar in the coming years.

According to Ark Invest, AI software revenue could hit $14 trillion  by 2030, up from $1 trillion in 2021. Many growth stocks will benefit from that trend, but Amazon (AMZN -0.67%) and Cognex (CGNX -0.95%) look particularly attractive given their current valuations.

Here's what investors should know.

Amazon: AI for software developers and advertisers

Amazon Web Services (AWS) dominates the cloud computing industry. It accounted for 32% of cloud infrastructure and platform services (CIPS) in the first quarter, and consultancy Gartner has recognized AWS as the CIPS leader for the last 12 years. That long stint as the market leader hints at an unparalleled capacity for innovation, and AWS has focused its innovation engine on AI.

Amazon Titan is a large language model -- an AI algorithm that can understand and generate text -- that lets developers build intelligent chatbots and other conversational AI applications. Titan is one of many foundational models available through Amazon Bedrock, a new cloud service that allows clients to build all sorts of generative AI applications. For instance, Bedrock also includes foundational models from AI start-ups like Stability AI, the creator of popular text-to-image app Stable Diffusion.

Amazon is also using generative AI to simplify workflows for developers and marketers. Amazon CodeWisperer leans on AI to write undifferentiated software code, giving developers more time to focus on the creative aspects of coding projects (i.e., the code that could actually differentiate their product). Amazon also plans to use generative AI to create visual media content like images and videos for advertisers. That service could accelerate growth in its already-booming advertising business, and more effective advertising could theoretically boost sales on its marketplace, too.

Investors should always keep the big picture in mind. AI could be a powerful growth driver for Amazon in the coming years, but it is only one bullet point in a broader investment thesis. Amazon runs the most popular e-commerce marketplace, it is the third-largest ad tech company, and AWS is the global leader in cloud computing. In other words, Amazon stock is worth owning because the company has strong competitive positions in three growing markets.

As a caveat, Amazon's financial performance has been somewhat lackluster of late. First-quarter revenue rose just 9% to $127 billion, and the company reported net income of $3.2 billion, meaning its profit margin was under 3%. But revenue growth should reaccelerate in a more favorable economic environment, and Amazon should become increasingly profitable as cloud computing and digital advertising represent a larger portion of total sales. Both of those businesses have higher margins than retail.

Currently, shares trade at 2.1 times sales, a bargain compared to the five-year average of 3.6 times sales. That's why Amazon is among AI growth stocks worth buying today.

Cognex: AI for factory automation

Cognex is the leader in machine vision technology, a type of AI in which machines capture and analyze visual information (much like the human eye) for the purpose of factory automation. Machine vision is generally faster and more accurate than human vision, which makes it ideal for guiding assembly robots, monitoring production lines, and detecting defects in products like semiconductors and electric car batteries. Cognex provides machine vision systems and software to customers in multiple industries, but its largest end markets are automotive, logistics, and consumer electronics.

Cognex struggled financially in the first quarter. Revenue declined 29% to $201 million and earnings fell 61% to $0.15 per diluted share, but management attributes those results to softening demand brought on by macroeconomic uncertainty. That headwind was most pronounced in its logistics business, where a few large e-commerce customers have paused expansion projects after investing aggressively in machine vision technology during the pandemic. That slowdown accounted for more than half of the revenue decline in the quarter.

However, economic headwinds are a temporary setback, and Cognex should have no trouble reaccelerating growth when those headwinds ease. The logistics industry is still early in its adoption of machine vision, and very few warehouses have realized the full potential of automation, according to CFO Paul Todgham. That bodes well for Cognex given its status as the machine vision leader.

Management believes its $6.5 billion addressable market will grow 13% annually in the coming years, but the company expects revenue to grow at 15% annually over the long term. In other words, Cognex is confident in its ability to take market share. With that in mind, shares currently trade at 9.3 times sales, a discount to the five-year average of 12.1 times sales. That creates an attractive buying opportunity for investors.