Last week, a Silicon Valley entrepreneur named Gabriel Leydon showed me the revolutionary potential of real-time bots. He showed me a test bot project that, if expanded, could almost literally run a country: its public transportation system, taxis, traffic lights, parking spaces, and more. That’s a pretty bold vision. But Leydon’s company may have a pretty good chance of pulling this off. The first test case goes live this summer in New Zealand.

‘We’re building bots to run countries’

Image Credit: Michael O'Donnell/VentureBeat

Most bots solve relatively small problems, like increasing the convenience of getting lunch. “We’re not building bots to order pizzas,” Leydon told me, alluding to the bot fad that has swept over Silicon Valley since Facebook launched a bot platform last month to help businesses interact with its 900 million users. “We’re building bots to run countries.”

Leydon is chief executive of MZ, a fast-growing company that has used its technology, built over the past nine years, to make Game of War one of the highest revenue-generating games in the app stores. The company’s tech keeps millions of gamers engaged by translating in-game messages across 32 languages in real time.

The New Zealand bot

It’s that cloud technology, which allows billions of interconnections to take place instantly, that MZ says gives it an advantage over competitors. Six months ago, Leydon decided to take his technology beyond games. On a trip to New Zealand, he noticed that the country had an open API for its public transportation system. Intrigued, he promised the New Zealand authorities he could build a command center to make its transport system much more efficient. He would start by building a pilot for the country’s largest city, Auckland. It would track the city’s entire fleet of 3,000 buses and the usage patterns of the up to 2 million people — residents and tourists — who ride those buses over the year.

The results surprised the New Zealand authorities when they reviewed the project for the first time earlier this month. First, Leydon unveiled a web page that showed authorities the real-time location of all of the city’s buses on a map, and how many people were in the buses. This step alone offered new, unprecedented transparency. For instance, officials could now see any buses that were running the wrong routes (see map above, where the red dots signify buses that are off-route). The problem, mostly created by innocent driver error, was producing havoc in the system and creating irate customers. The live dashboard gives authorities more power to take action.

Second, Leydon unveiled a mobile app for riders, to let them manage their time better. It allows riders to see when a bus is expected to arrive at any bus stop. The app can alert riders immediately if a bus is delayed. No other modern city public transport system can do this in the same way.

Firehose for a country

Expand the vision, and you can imagine a bot that runs the entire country’s infrastructure, including taxis, parking, and more. All of this is in the roadmap. MZ’s goal is to eventually place enough devices to track all activities in New Zealand so that they are mirrored in a virtual world. Leydon calls this a “firehose for a country,” and he envisions adding everything from the health care system to the power grid, police, emergency responders, and more. Leydon showed me the demos, and explained his vision, all within an hour’s visit last week, and it left my head spinning with possibilities. Could this finally pave the way for true Internet of Things applications that legacy evangelist companies like Cisco and Intel have buzzed about for years, but never really fulfilled?

Beyond countries, to companies

Take Wal-Mart, the $225 billion retail giant, which has an insanely large supply chain. Wal-Mart has millions of customers, hundreds of thousands of registers, thousands of drivers, tractors and trailers shipping items from distribution centers to stores, and millions of goods coming from places like China. If you put a bot on top of something like this, you suddenly can manage inventory and people much more efficiently. Through artificial intelligence, you can reorder and cancel goods in real time, based on streamed information. “Imagine being able to network all of that,” Leydon said.

MZ technology, which has now been spun out and called RTplatform, has two parts that make it especially suited to run such a complex system, Leydon said. First, its real-time capability. RTplatform can create a single data feed of millions of tracked activities, which can be searched at any time — something that legacy technology providers can’t do because they require searches of databases that add seconds in latency. This allows MZ to create a bot to allow people to submit queries and get answers in milliseconds, instead of several seconds. The second aspect is scale. The Auckland experiment draws on less than a single percent of the RTplatform’s capacity. The MZ technology can handle hundreds of millions of interactions a second. The New York Stock Exchange’s operation center, by contrast, maxes out at about 8 million messages a second.

Many applications haven’t even been thought of

But more than speed and scale, it’s the joining up of the two sides — riders, via their mobile phones, and public infrastructure, via sensors — that opens up a whole new set of opportunities that haven’t been tried, or even thought of, before.

Auckland authorities could build an artificial intelligence layer to help them make decisions in real time as information comes in. For example, in a crisis situation, authorities could program a decision to turn every single traffic light red. Or if Auckland City Center were to host a big event, an administrator could ask the system to close all parking within a square mile of the event. People driving into the city would see the blocked parking and make alternative parking plans.

And the system could grow bigger than just public infrastructure to embrace the Wal-Mart example above. MZ is building an open API, and so operators — including private companies — could decide to add their own assets to the system, too. So, for example, MZ might offer users a list of buses or taxis in their proximity, but also cars from private companies like Uber or Lyft. Add in retail stores, restaurants, airline information — it’s hard to know what MZ’s system can’t accommodate.

Despite the excitement around bots in Silicon Valley, few people talk about how to build the software layer to make bots efficient and useful, Leydon said. The magic of the New Zealand system is that it offers a concrete way to do this: Create a messaging layer that ties all devices together, offer management software for public officials and businesses, and make consumer-friendly software for regular people.

‘I want people to copy us’

Leydon says his project could reflect the future of the Internet. It could tie in the entire U.S. population as well. “It’s like a giant MMO (massively multiplayer online) game,” Leydon said, only half-joking.

Surely there must be technology that can compete with what MZ has developed, I prodded Leydon, citing Wall Street’s massive investments in high-frequency trading software. Leydon responded that while Wall Street companies have built formidable technology to make real-time bids on financial assets, they haven’t expanded outside their industry. Moreover, they can’t accommodate the massive number of two-way inputs that MZ’s technology can. Giant Internet companies like Google, Amazon, and Microsoft have built so-called “Pub/Sub” messaging systems, but they don’t offer a way to do real-time searches of streamed data at scale, or provide a bot control on top of that stream.

Besides, even if other competitors do show up, “that shouldn’t be a problem,” Leydon says. MZ has a two-year technology lead, he estimates, based on the optimizations his company has made on the technology over the past nine years. His main challenge is not defending the tech, he says, but in getting people to understand its potential. “I want people to copy us,” he says.

Building the ‘IOT’ platform

The RTplatform could be disruptive in other areas, such as search. Google’s search architecture is built around crawling and indexing static web pages, for the most part. But people are expecting more real-time data, said MZ product manager Wei Luo. She said that’s why messaging services like Twitter, Whatsapp, Messenger, and WeChat have gotten hundreds of millions — and in some cases, billions — of users. Google would have to rebuild its architecture entirely to be able to search for things happening now, or to get notifications about things as they happen. Notably, Luo used to work at Google before coming to MZ last year.

Leydon has recently bolstered the team working on the RTplatform, in an effort to start selling licenses for the technology. He just hired Nasi Jazayeri, former executive vice president of Salesforce Community Cloud, to run the platform. MZ won’t disclose the names of its potential customers, but announcements will be made in coming weeks.

So just how big a market is MZ looking at? Leydon reminded me that the smart city market alone is expected to total $1.4 trillion by 2020, tripling in size over just 17 years, according to Grand View Research. Open this up to services outside of cities and the potential gets gigantic.

Whether or not Leydon realizes his full vision remains an open question. So far, he has shown audacious and meticulous planning, first betting his entire company to make a single game, Game of War, despite huge competition — and contrary to conventional wisdom of the time: that you needed multiple games to get successful scale. Game of War became a bestseller, not because it had viral appeal, but because of the power of the technology driving it, Leydon said. New Zealand is just the next step in that grand plan.

“We’ve been building our business around real time at massive scale for years,” Leydon said. “The next decade of the Internet will be about real time. It’s the rise of the Internet of Things.”