Private beta The X2 SDK is now in private beta

Agents made code cheap. X2 makes it fast and reliable

Your coding agent can write an app in an afternoon. Then a deploy restarts a worker halfway through, and you are the one counting rows to find what ran twice.

X2 by AlgoX2™ is a platform for building durable, reliable apps. It holds your events, runs your code next to them, and gives every service the same stream. After a restart, your code picks up exactly where it left off, with nothing lost or duplicated.

Swiftward

Canvas

Exchange

Click counts

Exchange

Swiftward

Canvas

Canvas

Exchange

Click counts

Swiftward

Click counts

Swiftward

Canvas

Exchange

Fleet9:41
Fleet

Can't reach the server

Trying again…

Log

/public/fleet/pos

  1. 00000{"id":1,"lat":40.721472,"lon":-73.998541,"spd":10.9,"to":"harbor"}
  2. 00001{"id":2,"lat":40.717408,"lon":-74.008759,"spd":9.5,"to":"square"}
  3. 00002{"id":3,"lat":40.706557,"lon":-74.016878,"spd":8.1,"to":"depot"}
  4. 00003{"id":4,"lat":40.704901,"lon":-74.016716,"spd":6.7,"to":"harbor"}
  5. 00004{"id":5,"lat":40.714879,"lon":-74.008397,"spd":11.6,"to":"square"}
  6. 00005{"id":6,"lat":40.721795,"lon":-73.998254,"spd":10.2,"to":"depot"}
  7. 00006{"id":7,"lat":40.715463,"lon":-73.994007,"spd":8.8,"to":"harbor"}
  8. 00007{"id":8,"lat":40.705209,"lon":-73.998889,"spd":7.4,"to":"square"}
  9. 00008{"id":1,"lat":40.721546,"lon":-73.998754,"spd":11.6,"to":"harbor"}
  10. 00009{"id":2,"lat":40.717155,"lon":-74.009021,"spd":10.2,"to":"square"}
  11. 00010{"id":3,"lat":40.706350,"lon":-74.016989,"spd":8.8,"to":"depot"}
  12. 00011{"id":4,"lat":40.705045,"lon":-74.016592,"spd":7.4,"to":"harbor"}
  13. 00012{"id":5,"lat":40.715162,"lon":-74.008132,"spd":6.0,"to":"square"}
  14. 00013{"id":6,"lat":40.721800,"lon":-73.998050,"spd":10.9,"to":"depot"}
  15. 00014{"id":7,"lat":40.715182,"lon":-73.994019,"spd":9.5,"to":"harbor"}
  16. 00015{"id":8,"lat":40.705056,"lon":-73.999108,"spd":8.1,"to":"square"}
  17. 00016{"id":1,"lat":40.721610,"lon":-73.998971,"spd":6.0,"to":"harbor"}
  18. 00017{"id":2,"lat":40.716896,"lon":-74.009282,"spd":10.9,"to":"square"}
  19. 00018{"id":3,"lat":40.706149,"lon":-74.017094,"spd":9.5,"to":"depot"}
  20. 00019{"id":4,"lat":40.705198,"lon":-74.016462,"spd":8.1,"to":"harbor"}
  21. 00020{"id":5,"lat":40.715443,"lon":-74.007866,"spd":6.7,"to":"square"}
  22. 00021{"id":6,"lat":40.721796,"lon":-73.997850,"spd":11.6,"to":"depot"}
  23. 00022{"id":7,"lat":40.714899,"lon":-73.994037,"spd":10.2,"to":"harbor"}
  24. 00023{"id":8,"lat":40.704911,"lon":-73.999331,"spd":8.8,"to":"square"}

Fleet

A dozen vans are out on deliveries. Each position they send is appended to one ordered log.

The host crashes. The map loses its server, and nothing more is appended.

The host is started again. The log carries on at the next offset, with nothing lost or duplicated.

The whole tracker is a sliver of one X2 node. One node handles 5 million messages a second.

The same node has room for many more apps beside it.

  1. A dozen vans are out on deliveries. Each position they send is appended to one ordered log.

  2. The host crashes. The map loses its server, and nothing more is appended.

  3. The host is started again. The log carries on at the next offset, with nothing lost or duplicated.

  4. The whole tracker is a sliver of one X2 node. One node handles 5 million messages a second.

  5. The same node has room for many more apps beside it.

The team behind AlgoX2 built Algo M2, a matching engine with a 16-microsecond round trip, and then NYSE Pillar, the New York Stock Exchange's trading platform. Pillar handles more than $100 billion in trades a day across 7 regulated exchanges.

Backed by $18 million from Bessemer Venture Partners, Fin Capital, Cota Capital, and other institutional investors and angels.

How X2 works

Each event has a number, set by the service that sends it. If the service sends it again, X2 sees the same number and keeps the first.

A retry can't write an event twicevan 1van 2sequencerkeeps one of each numberretry of report 41: droppedreport 41 · van 1404142434445nextone stream, one order
Scroll sideways for the whole diagramTwo vans send reports to the sequencer, and each report has a numbered position on one stream. A retry of report 41 lands on the same position and is dropped.

Your program starts inside X2, beside the data it reads. As it works, it saves checkpoints: its state and how far it has read.

Your code runs inside X2404142434445nextone stream, one orderinside X2zone checkreads each event in ordersavescheckpointvan 3: in delivery areathrough event 43
Scroll sideways for the whole diagramInside X2, the zone check reads the stream and saves a checkpoint: the zone each van is in, and the last event that includes.

After a crash, your program starts again from its last checkpoint. It reads only what came after, so every event counts once.

After a crash, your code picks up where it stopped404142434445nextone stream, one ordercovered by the checkpointcheckpointvan 3: in delivery areathrough event 43zone check · crashedloadszone checkrestartedreads on from 44
Scroll sideways for the whole diagramThe zone check has crashed. X2 starts it again, the new one loads the checkpoint that goes through event 43, and reads on from event 44.

Billing, analytics and anything you add later read the same events in the same order. Each uses X2's client or the Kafka or NATS client it already has.

Every service sees the same events in the same ordervanssequencer41424344789one ordered streamalerts, one per crossingzone checkcheckpointreportsKafka clienttracking pageNATS clientnew serviceX2 client
Scroll sideways for the whole diagramVans, the sequencer and one ordered stream; the zone check reads it, keeps a checkpoint and writes a stream of alerts; three services read that stream: reports with a Kafka client, a tracking page with a NATS client and a new service with the X2 client.

That is one X2 node. An app that starts on one machine can grow a long way before it needs a second.

You won't outgrow itone X2 nodeone machine5,000,000messages a secondyour app todayroom to growa second node
Scroll sideways for the whole diagramOne X2 node handles 5 million messages a second. An app that starts on it uses a small part of that, and has room to grow before it needs a second node.

Without X2, with X2

Without X2

VansMQTTReportsKafkaSupportRedisTracking pageWebSocketDelivery recordsSQLMQTT brokers ×3own sessionsConnectors ×3own offsetsEvent log ×6own offsetsStream job ×3own checkpointsCache ×4own offsetsPush servers ×2own offsetsDatabase

With X2

VansMQTTReportsKafkaSupportRedisTracking pageWebSocketDelivery recordsSQLOne ordered log1 nodeYour programthe zone checkDatabase
Without X2With X2
6
systems to run
21
processes
6
records of progress
1
system to run
1
process
1
record of progress
Support, the tracking page, reports and delivery records each add a system.All four read from the same X2, and each keeps the client it already uses.
When one server isn't enough, each system turns into a cluster.One X2 node runs the whole tracker and still has room to grow.
Each cluster keeps its own record of how far it got.X2 keeps a single record of how far everything got.
Your agent can write the glue code. After a crash, you make six records agree.After a crash, there is nothing to make agree. Your database stays where it is.

On your machine

Run Fleet on your machine

Start Fleet on a local X2, send it vehicle positions, and read them back with the tools you already have.

  • C++
  • Python
  • Go
  • Rust
  • TypeScript
  • Java

Linux (x86_64 and arm64), in Docker, Podman or Kubernetes.

Try it now

Built on X2

Apps built on X2. The samples come with the SDK to read, run and copy from.

A screenshot of Swiftward

Swiftward

Controls what AI agents are allowed to do, such as sending a payment or using a tool, and proves every decision they make. Both parts can now run on X2 to handle very high load.

Communityswiftward.dev

A screenshot of Canvas

Canvas

A vector editor where several people draw in one room at once, and anyone can go back to an earlier version. Behind the page there is no server code, only X2.

Communitycanvas.void.engineering

Exchange

A small exchange with two matching engines running side by side. Kill one while orders are coming in. The other carries on, and every trade is on the tape once.

Sample

Click counts

Counts clicks per page, the same way you'd count API calls for a bill. Crash it halfway and count again. You get the same number. About 160 lines of C++.

Sample

Postgres change log

Insert an order into Postgres, then read that customer's new total. Normally that takes a connector, an event log, a stream job and a second connector. Here it's about 250 lines of C++.

Sample

“Any product with high load comes to this architecture in the end. X2 is that architecture, ready to use. It was the fastest event log we tested, and after kill -9 no decision was lost or made twice.”
Konstantin Trunin,founder ofSwiftward

Questions

What is X2?

X2 is a platform for building durable, reliable apps, made by AlgoX2. Your code runs inside X2, next to its data. Every event goes on one ordered log and is applied once. After a crash, X2 restarts your code from its last checkpoint, with nothing lost or applied twice.

Do I need X2 if Postgres and Redis already do the job?

Not yet, if Postgres and Redis do the job today. You need X2 when your app starts to need a queue, a workflow engine and recovery code as well. Adopting X2 before you build those costs less than replacing them later. To try it, you need one machine and your existing Kafka or NATS client.

Why X2 and not Temporal, Restate or Inngest?

Their streams belong to one workflow or one key, and you read them through their SDK. X2's streams are shared across all your services, and your services read them with the Kafka or NATS clients they already use. If your work is a few workflows with their own state, one of the three is the better choice.

What does X2 mean by "correct"?

Correct means no event is lost and none is applied twice. Every event has one place in one ordered log, so a deterministic program gets the same result every time it reads the log. X2 doesn't check your business logic.

How do you know X2 is correct?

We check the protocols that keep X2 consistent through failures in TLA+, a model checker: choosing a leader, a server failing and restarting, moving work between servers. Most of these checks rerun on every code change. The checker has found real bugs, such as an election with two winners. We fixed each one, and the election fix has a test that kills servers to recreate the case.

What happens if an X2 server fails?

Kill a server in the middle of a write: the others take over its work, and no record is lost or written twice.

Do I still have to de-duplicate events?

No. X2 drops duplicates for you. A writer names the position of each message, so a retry lands on the same position and is dropped. Your program inside X2 numbers its output from its input position, so a restart doesn't write a result twice. Over the Kafka protocol, idempotent producers work and transactions don't.

Does X2 replace my database?

No. X2 has no SQL and no joins, so your app keeps its Postgres. Your events, your lookups by key and the code that reacts to them go in X2. Anything you query with SQL stays in Postgres. The two connect by logical replication, in and out.

Can I use my Kafka, NATS or Redis clients?

Yes. Stock Kafka, NATS and Redis clients connect to X2, so you don't rewrite a service to try it.

Which languages does X2 support?

X2 has clients for C++, Python, Go, Rust, TypeScript and Java. Every client connects, publishes, reads a stream and follows it.

Is X2 open source?

Partly. The client libraries, samples and docs are open source under Apache 2.0. The X2 server is not: it ships as binaries under the PolyForm Noncommercial license, and its source is not public. You can develop and test on it for free.

What does X2 cost?

X2 is free to develop and test on, and free for noncommercial use. Commercial use needs a paid license.

What is X2 not for?

A few jobs are better done elsewhere. Keep your database for SQL and analytics. Functions that start, send one message and exit, like AWS Lambda, aren't a fit. And there is no hosted X2 yet, so you run it yourself.

Try X2 by AlgoX2™ on your machine. It is free to develop and test on.

Download X2 SDK

The SDK has a local X2, the docs, the tutorials and the samples.