The Iran war threatens to drive energy prices, inflation and interest rates still higher, crushing growth. Artificial intelligence is costing staggering sums, as US technology companies pour hundreds of billions of dollars into building infrastructure such as data centres. AI is mind-blowing technology that's already changing how we work and play, both for better and worse. But what if the bubble bursts?

One thing is indisputable. AI eats money. So-called AI 'hyperscalers' have "monumental spending plans", according to AJ Bell investment director Russ Mould. "Alphabet, Amazon, Meta, Microsoft and Oracle are targeting total capital spending of $845billion (£625bn). That alone equates to around 2.5% of US GDP."

These are popular, profitable companies, but others aren't. "Two of the biggest buyers of the silicon chips and data centres are OpenAI and Anthropic, neither of which makes a profit. Nor are they expected to do so for years to come," Mould said.

There was excited talk of these two companies floating on the stock market, following the record-breaking IPO of SpaceX, that briefly made founder Elon Musk the world's first trillionaire. SpaceX is also pouring a fortune into AI, while running at a loss..

Investors are also worried about a "circular investment loop", after chip maker Nvidia launched a $500 billion financing deal, designed to support customers who couldn't otherwise afford its expensive hardware. That's a bit like Tesco lending you money for your weekly shop. Risky for you, risky for Tesco.

The so-called Magnificent Seven US tech stocks (Alphabet, Amazon, Apple, Meta, Microsoft, Nvidia, and Tesla) now have a combined value of $23.4 trillion. That's bigger than China's entire economy and almost six times the size of the UK. The sheer scale is terrifying.

Basically, they're taking a gamble with the world. The big punt on AI hopes to drive economic growth and profits through productivity gains. Yet it will cost a fortune and will face other hurdles too, as massive data centres squeeze energy, water and commodity supplies, driving up prices. If the AI bubble does burst, it would smash the real economy as well as the financial one, Mould said. So how close are we?

Mould offers a checklist of risk factors. They include stock indices that are heavily skewed toward a single red-hot sector, a rash of IPOs, and markets moving from the back pages of newspapers to the front. On many, we're there.

Disaster isn't inevitable, said Ben Barringer, head of technology research at Quilter Cheviot. "Amazon, Alphabet and Microsoft all recently posted stellar results. Spending on data centres is leading to faster hyperscaler cloud growth. AI is helping advertisers maximise returns. This, in turn, is generating higher ad spending."

Technology stocks are trading at a 20% premium to the broader US stock market, but Barringer said this reflects their superior growth prospects. "Outperformance is now in its sixth year."

Pension and Stocks, and Shares ISA investors have done brilliantly out of US tech, but should tread carefully today. As ever, diversification is key. Spread money across other parts of the stock market, as well as safe havens like cash, bonds and gold. Shunning US tech altogether has risks, too. If AI lives up to the hype, fortunes will be made.