Between the looming threat of Brexit and President Trump’s unpredictable tariff moves, businesses have been scrambling to keep supply lines moving without incurring heavy costs or delays.

In fact, this period of uncertainty may be the wakeup call we all needed to design the type of modern, flexible trading networks we should have had all along. Sixty years of relative stability in global trade encouraged businesses to build efficient but highly rigid supply chains that minimize cost but make it difficult to adapt quickly.

Businesses have squeezed inefficiency out of supply chains to make them as lean as possible. Smaller inventories and just-in-time delivery allow for smaller and fewer warehouses, but they also make us more vulnerable when turmoil strikes. Well, turmoil is here, but the good news is that times of change can bring great value, and those who adapt to the current challenges will be set up for success in the future.

For American businesses, the tariffs on China have been particularly hard-felt. Makers of goods from fireworks to fabrics to figurines have been forced to look for new suppliers, and some are coming up short. And China is not alone: Mexico, Canada, France, Germany, and several other countries have faced the threat or reality of new import levies.

Tariffs are not the only concern. With Brexit looming, businesses in Europe are preparing for long delays at the UK border, where customs stations are expected to be overwhelmed. Some importers are stockpiling inventories to counter the expected delays, but that creates additional cost.

As if this weren’t enough, climate change is predicted to further disrupt supply chains, due to natural disasters and shifts in resource availability.

So what can businesses do to mitigate these risks? Here are five measures you can take to increase visibility into your supply chain and make decisions quickly when disruption occurs, potentially shifting to new suppliers and locations as needed.

1. Know your dependencies

Many supply chains extend far beyond first-tier suppliers. If you’re importing a good from one country, your supplier may well be relying on components from several other countries. (Consider the humble tennis ball: This tiny object can traverse four continents and 13 suppliers on its path to production.) It’s important to map out these n-tier dependencies to have visibility into the entire supply chain. That way, if disruption strikes a distant part of your network, you’ll be able to spot it earlier and take steps to reduce the impact.

Keep in mind, even if you already have two suppliers for a product in different countries, they may depend on the same supplier in a third country. In other words, even with diversity in your first-tier suppliers, you may still be vulnerable further up the chain. It’s important to know these points of failure.

Several tools today can help to map out first-tier suppliers, including the accounts payable modules of ERP systems. Spend analytics tools like Spendata and Sievo can categorize this data and show overlap between suppliers, and vendors like Risk Methods can take that analysis and display real-time risk alerts. But this is all for first-tier suppliers only; to get this visibility deep in the supply chain, buyers will need to require these tools for each of their key suppliers.

2. Understand your bill of materials

Without a detailed, accurate bill of materials, you can’t see where all these dependencies lie. That means knowing all the raw materials and components for the products you sell and where they are sourced from. These should be ranked in order of importance to the business, so you know where to prioritize action.

With this information, you can make informed decisions about whether you need to diversify your supplier base, stock up on certain products, or have products shipped earlier to offset delays. You might even consider designing a different material into a product, or using a technology like 3D printing to move production closer to home.

Any of these decisions may add costs and involve trade-offs, but you can’t make them wisely until you know your bill of materials.

There’s no single tool today that provides those insights. It’s typically managed by the chief procurement officer, who works with product line managers to build the tools and processes required. These stakeholders should meet regularly to understand the costs and ramifications of any events that may arise.

3. Consider alternative suppliers

In the case of tariffs, some businesses can mitigate the impact by absorbing the cost themselves or passing it on to consumers, but that’s not always feasible. The next-best option is for an existing supplier to move deliveries to a non-tariff country. Failing that, explore a new supplier in a non-tariff country — but that may require a new round of qualification and testing.

4. Know your network

Trading relationships have evolved since the days of the fax, but many businesses still use rigid, one-to-one EDI connections that make it hard to onboard new suppliers quickly. There are many marketplaces available — Alibaba and TradeKey to name just two (my company is another) — that bring together buyers and sellers and provide a standardized mechanism for transactions.

These make it easier to identify and connect with new suppliers when they’re needed.They also give you more visibility into your supply chain to help you spot potential problems (e.g., if your supplier or your supplier’s supplier is experiencing delivery delays).

5. Experiment with AI and machine learning

The level of visibility you’ll get from all of the above measures will generate a tremendous amount of information that may overwhelm current systems and procurement teams. Machine learning tools provide a way to analyze all these data points and suggest alternative courses of action.

Machine learning can also examine historical data to detect, for example, that one strand of a supply chain encounters delays more frequently than another, or under certain conditions. These patterns can go undetected by humans but are easy for machines to spot when they have the right information.

The key here is to have accurate data and a robust understanding of the suppliers and products that impact your company’s ability to meet its contractual commitments. We’re at the very beginning of using AI to manage these variables, and businesses today may need to build their own tools to suit their unique environments, in part using public AI cloud services. But this will change as more vendors step in to address the need.

Bottom line

Businesses are in a new period of uncertainty that requires greater flexibility and discipline for supply chain operations. That means understanding your supplier network, knowing your bill of materials, and having a procurement system that allows you to adapt quickly when the need arises. For the foreseeable future, the cost of implementing change will be just as important as the cost of doing business, and smart enterprises will adapt quickly to accommodate this new reality.

Roy Anderson is the Chief Procurement Officer and Digital Transformation Officer at Tradeshift.