When it comes to artificial intelligence (AI) stocks, chances are investors' thoughts may turn to semiconductors, massive data centers, or cloud computing infrastructure. This is great news for chip powerhouses and hyperscalers like Nvidia, Advanced Micro Devices, Broadcom, Taiwan Semiconductor Manufacturing, Microsoft, Amazon, or Alphabet, but investors could be overlooking emerging opportunities beyond the usual suspects.

Enterprise-grade software will become an increasingly vital layer atop the hardware stack. The commercial angle is to market AI-powered software to large corporations with complex needs spanning data analytics, logistics, human resources, cybersecurity, and more.

But there is another opportunity outside of the private sector: how AI is redefining one of the largest and most sophisticated enterprises of all, the U.S. government. Earlier this year, Defense Secretary Pete Hegseth announced a plan to allocate more spending toward the Software Acquisition Pathway (SWP), a strategy first deployed in 2020. Its stated aim is to "provide for the efficient and effective acquisition, development, integration, and timely delivery of secure software."

Let's explore how Palantir Technologies (PLTR -2.14%) and BigBear.ai (BBAI 5.39%) are capitalizing on AI's shift from hardware to software and how each company is approaching the opportunity with SWP.

1. Palantir Technologies: The AI darling of the U.S. government

Palantir has been at the center of several notable deals with the federal government throughout 2025. In late May, it deepened its relationship with the Department of Defense (DOD) through a $795 million extension featuring its Maven Smart System (MSS). This brought the total value of the MSS program to $1.28 billion, making it a long-term revenue driver. More recently, the company won a deal with the Army reportedly worth up to $10 billion over the next 10 years.

Palantir's wins extend beyond the U.S. military as well. The company is building the Immigration Lifecycle Operating System -- often referred to as ImmigrationOS -- for Immigration and Customs Enforcement (ICE).

Signing multiyear billion-dollar deals provides Palantir with high revenue visibility, keeps its customer base sticky, and opens the door to upsell or cross-sell added services down the road.

The ability to parlay its defense expertise into other government functions also expands Palantir's public sector footprint and reinforces the breadth of its capabilities -- solidifying its role as a ubiquitous AI backbone for the U.S. government.

Palantir Q2 2025 U.S. revenue growth.

Image source: Palantir Investor Relations.

2. BigBear.ai: A niche player helping the public sector

Another AI software developer that has signed deals with the U.S. government this year is BigBear.ai. In February, it won a contract with the DOD to design a system to assist national security decision-making by analyzing trends and patterns in foreign media.

Military personnel reviewing details for a mission.

Image source: Getty Images.

Shortly thereafter, the company won a $13.2 million deal spread over three and a half years to support the Joint Chiefs of Staff's force management and data analytics capabilities.

In May, the company partnered with Hardy Dynamics to advance the Army's use of machine learning and AI for autonomous drones.

Lastly, BigBear.ai has a deal with U.S. Customs and Border Protection to deploy its biometric AI infrastructure system, called Pangiam, at a dozen major airports across North America to help streamline arrivals and improve security protocols.

Which is the better stock: Palantir or BigBear.ai?

Between the two stocks, I see Palantir as the clear choice. BigBear.ai has proved it can win meaningful government contracts, but its work is more niche-focused and smaller in scale compared to Palantir's multibillion-dollar deals across multiple platforms.

In my view, BigBear.ai's popularity is largely with retail investors who are hoping that it becomes the "next Palantir." Smart investors know that hope is not a real strategy. Prudent valuation analysis -- and not speculation -- is required to know which stock is truly worth buying.

While some on Wall Street may argue that Palantir stock is cheap based on software-specific metrics such as the Rule of 40, I'm not entirely bought into such a narrative.

PLTR PS Ratio Chart

PLTR PS Ratio data by YCharts.

Traditional approaches to valuation, such as the price-to-sales ratio (P/S), show that Palantir is the priciest software-as-a-service stock among the businesses in the chart above -- and its valuation expansion means that shares are becoming even more expensive as the stock continues to rally.

Palantir is an impressive company that has proved it can deliver on crucial applications, but the stock is historically expensive. I think that investors are better off waiting for a more reasonable entry point and paying a more appropriate price down the road.