Since Donald Trump was announced president-elect, the S&P 500 (^GSPC -1.11%) has gained roughly 2% while the Nasdaq Composite (^IXIC -1.49%) has jumped by about 5%. At a high level, these moves suggest that stocks have broadly been moving higher over the last month or so.

However, two stocks that could not be moving in more opposite directions since the election was called are government consulting operation Booz Allen Hamilton (BAH -0.57%) and enterprise software company Palantir Technologies (PLTR -3.72%).

Since Nov. 6, shares of Booz Allen declined roughly 25% while Palantir stock soared by almost 40% (as of market close on Dec. 13).

But in early December, Booz Allen and Palantir announced a strategic partnership that could be a game changer for both companies. Let's explore how the two companies are collaborating, and what it could mean for long-term growth for each enterprise as the artificial intelligence (AI) era continues to unfold.

What caused the post-election stock movements in Booz Allen and Palantir?

One of Trump's campaign promises was to create a new government agency focused on identifying and cutting excess budget spend in order to improve the federal deficit. Given Booz Allen is a consulting firm that works closely with the government, the sell-off in the stock was likely induced by investor panic that business for the company will suffer as Trump's initiative puts a more stringent eye on government projects.

By contrast, Palantir already has an existing footprint with the U.S. government -- particularly with the Department of Defense (DOD). Through the nine months ended Sept. 30, Palantir generated $1.1 billion of revenue from its public sector operation -- an increase of 24% year over year and comprising approximately 55% of the company's total revenue base.

Given the increasing focus on national security amid geopolitical unrest in Eastern Europe and the Middle East, combined with the military's rising focus on artificial intelligence, it's not surprising to see Palantir stock get a jolt of investor enthusiasm following the election.

A U.S. soldier and businessperson exchanging a keychain.

Image source: Getty Images.

How are Palantir and Booz Allen working together?

While Palantir is regarded as a high-quality software developer, it's important to understand that integrating its technology can often be a complex and time-consuming exercise. Generally speaking, software companies may have a professional services team that helps new customers implement their new tools in a seamless, efficient way so they can start tackling problems and identify use cases.

I see the partnership between Palantir and Booz Allen as an expansion of that idea. While Palantir specializes in AI software applications, Booz Allen carries the expertise needed to integrate these tools in niche, complicated environments such as those in the defense industry.

By focusing on "information infrastructure modernization," Booz Allen and Palantir are seeking to accelerate the pace at which military operations are carried out in the AI era.

Why the deal is a game changer

I see the deal between Booz Allen and Palantir as mutually beneficial, and one that could be a game changer for both companies.

For Booz Allen, I think the company has swiftly identified a way to circumvent a potential deceleration in its business given the microscope on the national budget. Moreover, by partnering with Palantir specifically, Booz Allen figured out a way to tap into the AI narrative. This move is in some ways quite similar to Accenture's partnership with Nvidia. My bigger point here is that consulting operations are positioned to play a big role in AI implementation for years to come, and so I am encouraged by Booz Allen's ability to get involved in the movement.

For Palantir, I think the obvious benefit is that working with Booz Allen could represent a new form of lead generation and help accelerate its government business. Historically speaking, public sector deal flow is lumpy and unpredictable. However, I think Palantir has done a respectable job of identifying new ways to become more involved with the U.S. government outside of bidding on large scale defense deals.

The collaboration between Booz Allen and Palantir is a win-win scenario and I am excited to see how the partnership bears fruit as the AI narrative continues.