By 2028, the value of the artificial intelligence (AI) market is expected to reach $361 billion annually, according to Fortune Business Insights. What makes that figure even more impressive is that to reach that level, the AI market will have to grow at a compound annual rate of 33.6% from 2021 to 2028.

For investors seeking ways to capitalize on this trend, I believe that two stocks will be great choices to buy and hold over the next decade. Upstart (UPST 3.90%) is disrupting a massive market -- and experiencing significant success in the process with a product that has AI at its core, while UiPath (PATH 3.49%) is assisting enterprises in their adoption of AI.

AI button on a circuit board.

Image source: Getty Images.

Upstart: A new decision-maker for banks

Upstart is radically changing how consumers get approved for loans. Banks typically look primarily at consumers' FICO scores and perhaps a handful of other factors to determine whether they will lend to them, and at what interest rates. Upstart instead uses an artificial intelligence platform that gauges credit risk based on thousands of variables -- even things like how a consumer interacts with the application. And the FICO score is not one of them.

Its smaller bank clients -- typically ones serving consumers with poorer credit scores -- use its platform to make lending decisions. Upstart tripled the number of banking partners on its roster from 10 in early 2021 to 31 at the end of the third quarter. And in that quarter, the company grew its top line by 250% year over year to $228 million.

One factor behind that rapid growth has been the impressive decision accuracy of the platform. At the same loss rate that traditional banks achieve with the standard lending model, Upstart can approve 173% more applications, which means more traffic and profit for its small bank partners at no additional risk.  

Upstart booked $76.5 million in net income in the first nine months of 2021, but it does have concentration risk. A single client represented 58% of its entire loan volume for that period. That was a decrease from the prior-year period, when that customer represented 72% of loan volume, but it's still a concern.

Upstart operates in the auto, home, and personal loan markets, giving the company a $5 trillion space to work in. With so much room to grow, along with clear advantages over its competition and robust profitability, it makes sense that it trades at a premium price-to-sales ratio of around 19. The stock has been volatile, though, and is currently down by more than 63% from its all-time high.  As such, its valuation is nearly as low as it has been at any point in the past year, so the shares can be viewed as a relative bargain.

Even without the now-lower share price, Upstart's impressive use of AI in a large industry has given me confidence that the company's product will see rapid success and adoption over the next decade, which is why I think investors should buy and hold this stock.

UiPath: AI for enterprises

If you want to invest in a more direct AI company rather than one that simply uses it, UiPath might be a good choice for you. It operates in the robotic process automation (RPA) space, creating software bots that can complete tedious, repetitive tasks. This frees up employees to work on more thought-intensive tasks, which can lead to drastic efficiency improvements. In one case study, UiPath found it had helped a single large customer automate 400,000 hours worth of work across its business.

UiPath's competitive advantage is the company's leadership in this rapidly growing space. Management predicts the RPA industry will be worth $30 billion annually by 2024, and both Gartner's (IT 1.62%) Magic Quadrant and IDC's MarketScape point to UiPath as the leader in the niche.

This dominance has led to impressive growth that will only continue as the industry and AI expand. In its fiscal 2022 Q3 (which ended Oct. 31), the company had 9,600 customers, more than 1,300 of which are spending over $100,000 with it annually. Among those businesses that have been customers for a year or more, spending was up by an average of 44% year over year in fiscal Q3 -- a reflection of the major efficiency gains UiPath's customers get from its services. Customers are only becoming more reliant on UiPath, which should result in high customer retention rates.

The main risk for investors is the company's unprofitability. UiPath's net loss in the first nine months of its fiscal 2022 was 77% of its total revenue, and that was up from 29.5% in the prior-year period. However, given the massive opportunities ahead for the company, management is not making profitability a major focus right now. Instead, it's spending money to gain market share and achieve revenue growth.

Leaders in fast-growing industries can make for good investments, and considering how reliant its customers are becoming on its products, I think that UiPath should be able to keep performing. And with the stock trading at a price-to-sales ratio of about 22 -- an all-time low since it went public -- it could be a bargain today.