# AI agents are about to rediscover the oldest risk in modern finance

> Source: <https://dev.to/barissozen/ai-agents-are-about-to-rediscover-the-oldest-risk-in-modern-finance-1mej>
> Published: 2026-07-22 06:08:51+00:00

On 26 June 1974, German regulators withdrew the banking license of Bankhaus Herstatt, a mid-sized bank in Cologne, in the middle of the trading day. The timing is what made it famous. Herstatt's FX counterparties had already irrevocably paid the Deutsche Mark legs of that day's trades in Frankfurt. The corresponding dollar legs were due to settle hours later in New York. They never did.

Banks that had done nothing wrong except pay first were left holding losses on trades that were half-settled: one leg complete, one leg gone. The episode was significant enough to name a category of risk - settlement risk, still called Herstatt risk - and it pushed the G10 central banks to form the Basel Committee on Banking Supervision later that same year.

Here is the part worth sitting with: the actual fix took 28 years.

CLS launched in 2002 with one job: settle FX trades payment-versus-payment. Both legs of a trade settle simultaneously, or neither does. There is no window in which one side has paid and the other has not. It works - CLS settles on the order of trillions of dollars a day - and it is the reason a Herstatt-style failure has not repeated at scale in the currencies it covers.

But look at the shape of the solution. To make two legs atomic, traditional finance built one institution that every major bank trusts, connected the world's main currencies to it, and routed the trades through it. Atomicity was achieved by adding the most systemically important middleman in the history of payments.

That was probably the only option available to 1990s banking infrastructure. It is not the only option available now.

A study published last week by Keyrock, run with Coinbase and Tempo, put numbers on machine-to-machine commerce: 176 million transactions, $73 million settled between May 2025 and April 2026, average transaction size around $0.31.

Those numbers describe a payments economy. A payment is a single leg: value moves one direction, against a service delivered off-chain. If it fails, you retry it. The current agent rail stack - HTTP-native payment standards, facilitator APIs, custodial escrow - is built around exactly this case, and for this case it is reasonable.

Trades are a different object. A trade is two or more legs that must move together: asset against asset, often on different chains, often between parties who met through a directory minutes earlier. And agent workflows compound legs quickly. An agent that sells one asset, uses the proceeds to acquire another, and posts part of the result as collateral is running a three-leg sequence where leg 2 depends on leg 1 and leg 3 depends on leg 2. A ring of three agents - data seller, compute provider, broker - settling a three-way exchange is a cycle of dependent legs.

For multi-leg structures, partial completion is not an edge case. It is the default failure mode.

Three properties of agent commerce sharpen the 1974 problem.

First, speed and volume. A human trading desk settles a manageable number of trades a day, with humans watching. An agent pipeline can half-complete a thousand multi-step sequences before anyone looks at a dashboard.

Second, counterparties are strangers by design. The premise of an open agent economy is that agents discover and transact with counterparties they have never seen before. There is no relationship, no credit history, no implicit trust to fall back on.

Third, there is no recourse layer. Two banks caught in a half-settled trade in 1974 had lawyers, regulators and decades of workout practice. Two autonomous agents caught in a half-settled trade have nothing, unless a human steps in - which is precisely what autonomy was supposed to remove.

The instinctive answer is the 2002 answer: add a referee. Put a custodian or an escrow agent in the middle and let it hold both legs. That imports the middleman, the fees, and the single point of failure - and, as we wrote yesterday, the agent economy is already accumulating those referees at speed.

There is a cryptographic construction that delivers the CLS guarantee without the institution: the hash-time-locked contract.

The two-leg version is the classic atomic swap. Both parties lock funds against the same hash H(s). The party holding the secret s claims the counterparty's leg by revealing s on-chain; that same revelation is what lets the counterparty claim the other leg. If s is never revealed, both legs refund after their timeouts expire. Both sides complete, or both sides get their money back.

The property generalizes. Lock N legs - a ring trade, a trade plus its collateral leg, a multi-step position assembly - against the same hash, and one revelation settles the entire structure while silence refunds the entire structure. All legs or none. That is payment-versus-payment and delivery-versus-payment collapsed into one primitive, enforced by a hash function instead of a Belgian settlement bank.

We call this multi-leg trade atomicity, and it is one of the five settlement primitives we are building at Hashlock.

Multi-leg atomicity is not free, and it is worth being precise about the costs.

Capital lockup. Every leg must be funded and locked for the duration of the settlement window. More legs means more capital-time committed before anything settles.

Timeout laddering. Refund windows cannot be arbitrary. They must be ordered so that every party who learns the secret still has time to claim their inbound leg, with each step padded by the confirmation time of the slowest chain involved. The total window therefore grows with leg count. Long rings across slow chains get expensive in time, which is a real constraint on how many legs are practical.

The last-mover option. The secret holder can wait until near the deadline to decide whether to reveal. For the window's duration, they hold a free option on the trade. Short windows, counterparty screening above the settlement layer, and pricing all mitigate this; none of them make it disappear.

Liveness. Parties must be online to claim within their windows, or delegate that job. A crashed agent that misses its claim window turns a completed trade into a refund.

These tradeoffs are why atomic multi-leg settlement is a primitive you reach for when counterparty risk matters more than latency - which is a good description of high-value trades between anonymous autonomous agents.

Status, precisely: settlement is live end-to-end on Ethereum mainnet. Sui contracts are deployed and CLI-tested, with gateway wiring in progress. Bitcoin support is validated on signet; mainnet is pending. Agents reach the protocol over MCP - six tools, npm package [ @hashlock-tech/mcp](https://www.npmjs.com/package/@hashlock-tech/mcp), currently v0.4.1. The settlement design is written up in our

FX markets earned atomic settlement the hard way: a bank failure, a new supervisory committee, and 28 years of infrastructure work. The agent economy gets to inherit the finished concept on day one.

If you are building agent workflows today: how many dependent legs does your longest flow have, and what happens right now if it stops halfway? I would like to hear what the failure story looks like in practice.
