On April 21, 2011, the region of Amazon Web Services covering eastern North America crashed. The crash brought down the sites of large customers such as Quora, Foursquare, and Reddit. It took Amazon over a week to bring its system fully back online, and some customer data was lost permanently.

But one company whose site did not crash was Netflix. It turns out that Netflix had made themselves “antifragile” by employing software they called “Chaos Monkey,” which regularly and randomly brought down Netflix servers. By continually crashing their own servers, Netflix learned how to nevertheless keep other portions of their network running. And so when Amazon US-East crashed, Netflix ran on, unfazed.

This phenomenon is discussed by Nassim Taleb in his book Antifragile: a system that depends on the absence of change is fragile. The companies that focused on keeping all of their servers up and running all the time went completely offline when Amazon crashed from under them. But the company that had exposed itself to lots of little crashes could handle the big crash. That is because the minor, “undesirable” changes stress the system in a way that can make it stronger.

The idea of antifragility does not apply only to computer networks. For instance, by trying to eliminate minor downturns in the economy, central bank policy can make that economy extremely vulnerable to a major recession. Running only on treadmills or tracks makes the joints extremely vulnerable when, say, one steps in a pothole in the sidewalk.

What does this have to do with trade policy? For many reasons, such as the recent coronavirus outbreak, flows of goods are subject to unexpected shocks.

Both a regime of “unfettered” free trade, and its opposite, that of complete autarchy, are fragile in the face of such shocks. A trade policy aimed not at complete free trade or protectionism, but at making an economy better at absorbing and adapting to rapid change, is more sane and salutary than either extreme. Furthermore, we suggest practicing for shocks can help make an economy antifragile.

Amongst academic economists, the pure free-trade position is more popular. The case for international trade, absent the artificial interference of government trade policy, is generally based upon the “principle of comparative advantage,” first formulated by the English economist David Ricardo in the early 19th century. Ricardo pointed out, quite correctly, that even if, among two potential trading partners looking to trade a pair of goods, one of them is better at producing both of them, there still exist potential gains from trade—so long as one of them is relatively better at producing one of the goods, and the other (as a consequence of this condition) relatively better at producing the other. For example, Lebron James may be better than his local house painter at playing basketball, and at painting houses, given his extreme athleticism and long reach. But he is so much more “better” at basketball that it can still make sense for him to concentrate on basketball and pay the painter to paint his house.

And so, per Ricardo, it is among nations: even if, say, Sweden can produce both cars and wool sweaters more efficiently than Scotland, if Scotland is relatively less bad at producing sweaters than cars, it still makes sense for Scotland to produce only wool sweaters, and trade with Sweden for the cars it needs.

When we take comparative advantage to its logical conclusion at the global scale, it suggests that each agent (say, nation) should focus on one major industry domestically and that no two agents should specialize in the same industry. To do so would be to sacrifice the supposed advantage of sourcing from the agent who is best positioned to produce a particular good, with no gain for anyone.

Good so far, but Ricardo’s case contains two critical hidden assumptions: first, that the prices of the goods in question will remain more or less stable in the global marketplace, and second that the availability of imported goods from specialized producers will remain uninterrupted, such that sacrificing local capabilities for cheaper foreign alternatives.

So what happens in Scotland if the Swedes suddenly go crazy for yak hair sweaters (produced in Tibet) and are no longer interested in Scottish sweaters at all? The price of those sweaters crashes, and Scotland now finds itself with most of its productive capacity specialized in making a product that can only be sold at a loss.

Or what transpires if Scotland is no longer able, for whatever reason, to produce sweaters, but the Swedes need sweaters to keep warm? Swedes were perhaps once able to make their own sweaters, but have since funneled all their resources into making cars, and have even lost the knowledge of sweater-making. Now to keep warm, the Swedes have to rapidly build the infrastructure and workforce needed to make sweaters, and regain the knowledge of how to do so, as the Scots had not only been their sweater supplier, but the only global sweater supplier.

So we see that the case for extreme specialization, based on a first-order understanding of comparative advantage, collapses when faced with a second-order effect of a dramatic change in relative prices or conditions of supply.

That all may sound very theoretical, but collapses due to over-specialization, prompted by international agencies advising developing economies based on naive comparative-advantage analysis, have happened all too often. For instance, a number of African economies, persuaded to base their entire economy on a single good in which they had a comparative advantage (e.g, gold, cocoa, oil, or bauxite), saw their economies crash when the price of that commodity fell. People who had formerly been largely self-sufficient found themselves wage laborers for multinationals in good times, and dependents on foreign charity during bad times.

While the case for extreme specialization in production collapses merely by letting prices vary, it gets even worse for the “just specialize in the single thing you do best” folks once we add in considerations of pandemics, wars, extreme climate change, and other such shocks. We have just witnessed how relying on China for such a high percentage of our medical supplies and manufacturing has proven unwise when faced with an epidemic originating in China.

On a smaller scale, the great urban theorist Jane Jacobs stressed the need for economic diversity in a city if it is to flourish. Detroit’s over-reliance on the automobile industry, and its subsequent collapse when that industry largely deserted it, is a prominent example of Jacobs’ point. And while Detroit is perhaps the most famous example of a city collapsing due to over-specialization, it is far from the only one.

All of this suggests that trade policy, at any level, should have, as its primary goal, the encouragement of diversity in that level’s economic activity. To embrace the extremes of “pure free trade” or “total self-sufficiency” is to become more susceptible to catastrophe from changing conditions. A region that can produce only a few goods is fragile in the face of an event, like the coronavirus, that disrupts the flow of outside goods. On the other hand, turning completely inward, and cutting the region off from the outside, leaves it without outside help when confronting a local disaster, like an extreme drought.

To be resilient as a social entity, whether a nation, region, city, or family, will have a diverse mix of internal and external resources it can draw upon for sustenance. Even for an individual, total specialization and complete autarchy are both bad bets. If your only skill is repairing Sony Walkmen, you were probably pretty busy in 2000, but by today you likely don’t have much work. Complete individual autarchy isn’t ever really even attempted: if you watch YouTube videos of supposedly “self-reliant” people in the wilderness, you will find them using axes, radios, saws, solar panels, pots and pans, shirts, shoes, tents, and many more goods produced by others.

In the technical literature, having such diversity at multiple scales is referred to as “multiscale variety.” In a system that displays multiscale variety, no single scale accounts for all of the diversity of behavior in the system. The practical importance of this is related to the fact that shocks themselves come at different scales. Some shocks might be limited to a town or a region, for instance local weather events, while others can be much more widespread, such as the coronavirus pandemic we are currently facing.

A system with multiscale variety is able to respond to shocks at the scale at which they occur: if one region experiences a drought while a neighboring region does not, agricultural supplementation from the currently abundant region can be leveraged. At a smaller scale, if one field of potatoes becomes infested with a pest, while the adjacent cows in pasture are spared, the family who owns the farm will still be able to feed themselves and supply products to the market.

Understanding this, the question becomes how can trade policy, conceived broadly, promote the necessary variety and resiliency to mitigate and thrive in the face of the unexpected? Crucially, we should learn from the tech companies: practice disconnecting, and do it randomly. In our view there are two important components to the intentional disruption: (1) it is regular enough to generate “muscle memory” type responses; and (2) it is random enough that responses are not “overfit” to particular scenarios.

For an individual or family, implementing such a policy might create some hardships, but there are few institutional barriers to doing so. One week, simply declare, “Let’s pretend all of the grocery stores are empty, and try getting by only on what we can produce in the yard or have stockpiled in our house!” On another occasion, perhaps, see if you can keep your house warm for a few days without input from utility companies.

Businesses are also largely free of institutional barriers to practicing disconnecting. A company can simply say, “We are awfully dependent on supplier X: this week, we are not going to order from them, and let’s see what we can do instead!” A business can also seek out external alternatives to over-reliance on crucial internal resources: for instance, if your top tech guy can hold your business hostage, it is a good idea to find an outside consulting firm that could potentially fill his role.

When we get up to the scale of the nation, things become (at least institutionally) trickier. If Freedonia suddenly bans the import of goods from Ruritania, even for a week, Ruritania is likely to regard this as a “trade war,” and may very well go to the WTO and seek relief. However, the point of this reorientation of trade policy is not to promote hostility to other countries, but to make one’s own country more resilient. A possible solution to this problem is that a national government could periodically, at random times, buy all of the imports of some good from some other country, and stockpile them. Then the foreign supplier would have no cause for complaint: its goods are still being purchased! But domestic manufacturers would have to learn to adjust to a disappearance of the supply of palm oil from Indonesia, or tin from China, or oil from Norway.

Critics will complain that such government management of trade flows, even with the noble aim of rendering an economy antifragile, will inevitably be turned to less pure purposes, like protecting politically powerful industrialists. But so what? It is not as though the pursuit of free trade hasn’t itself yielded perverse outcomes, such as the NAFTA trade agreement that ran to over one thousand pages. Any good aim is likely to suffer diversion as it passes through the rough-and-tumble of political reality. Thus, we might as well set our sites on an ideal policy, even though it won’t be perfectly realized.

We must learn to deal with disruptions when success is not critical to survival. The better we become at responding to unexpected shocks, the lower the cost will be each time we face an event beyond our control that demands an adaptive response. To wait until adaptation is necessary makes us fragile when a real crisis appears. We should begin to develop an antifragile economy today, by causing our own disruptions and learning to overcome them. Deliberately disrupting our own economy may sound crazy. But then, so did deliberately crashing one’s own servers, until Chaos Monkey proved that it works.

Gene Callahan teaches at the Tandon School of Engineering at New York University. Joe Norman is a data scientist and researcher at the New England Complex Systems Institute.