If you’re worried about the future and where technology might lead us, 2017 didn’t help. The warnings kept rolling in about potential job losses from automation and machine learning. More than 375 million of us will need to completely change occupations to avoid being replaced by robots, a recent report estimated. Meanwhile, artificial intelligence keeps getting smarter: The world got its first robot citizen, another robot learned to do backflips, and DeepMind’s AI has mastered chess.

It doesn’t need to be so frightening, says Tim O’Reilly, the founder and chief executive of O’Reilly Media. O’Reilly is known for spotting and promoting trends and innovations such as open-source software and web 2.0. In his new book WTF: What’s the Future and Why It’s Up to Us, published by Penguin Random House in October, the tech thinker and writer envisions a future in which people, particularly tech and financial executives, make smart, conscientious decisions to harness technology for good.

“WTF,” most commonly called upon as an expletive, but also an expression of astonishment, addresses the “profound sense of unease and even dismay” that many people experience when confronted with advanced technology, O’Reilly writes.

With the right choices, machines doesn’t have to put humans out of jobs. Rather, they could create work—and joy— for us. O’Reilly is keen to stress this ideal future, where AI brings us unimaginable delights and higher standards of livings, can only be achieved if we radically change how we view our economy and capitalist system.

“We are at a very dangerous moment in history,” O’Reilly warns. While some of his Silicon Valley neighbors believe we are on a steady march towards singularity, where machine and human brains melt into one force, O’Reilly has a reminder that nations can fail, civilizations can collapse, and technology can go backwards. Climate change, wealth inequality, intergenerational inequality, astronomical CEO pay, and the constant pursuit of corporate profits are all pitfalls that technology could exacerbate. It’s getting harder and harder to solve the problems we have created, he says.

For all its warnings, WTF is defiantly optimistic, and in some places surprisingly almost Marxist. It’s light on practical steps to achieve these idealistic goals, though they include more progressive taxes on financial investments and a “radical” shake up of the education system. However, there is a genuine plea for action, or at least thought, on building a better future. O’Reilly is inquisitive, sourcing ideas and thoughts from across history and disciplines, while the book is littered with quotes from literature, and by historical figures, entrepreneurs, economists, and friends in high places.

Quartz spoke to O’Reilly in London about technology’s role in building a better society. The conversation has been edited and condensed.

Quartz: You’ve been in publishing for decades. Why did you decide this would be your first book for a general audience?

“Let’s not just celebrate disruption, let’s start to identify the world that we want to build.”

Tim O’Reilly: I could see the current tech backlash coming. There’s been a narrative that robots are going to take all the jobs and we’ll have a new Precariat [a social class suffering from an existence without predictability and job security]. I wanted to address the entrepreneurs in Silicon Valley who seem so tone deaf, policymakers, and of course the general public. I wanted to shape ideas and the story I felt I needed to tell was that the digital revolution is coming to the real world and it’s going to be messy but let’s not just celebrate the disruption, let’s start to identify the world that we want to build.

What does the disruption look like in that world?

I refute the idea that robots are going to take all the jobs. There’s plenty of work to be done, just look around. We have crumbling infrastructure, the looming specter of climate change, aging populations in the developed world who are going to need care, and government and healthcare systems that are stuck in the last century. There’s so much work to be done.

Early on in the book you warn that civilizations can fail and technology can go backwards. Is that a general warning or related to something specific you see in the world today?

“Climate change will either crush us as a society or we will rise to and it will allow us to transform our society.”

I studied classics, so how nations fail has always been in the backdrop of my mind. Futurist and inventor Ray Kurzweil talks about steady march towards the singularity but on human timescales there’s big flat line periods, or downward spikes. It is possible for the world to go sideways, look at things like climate change and the anti-science, anti-progress, extractive, crony capitalism that is taking over governments around the world in the name of populism. We could end up in a very, very, dark time. There’s really two possibilities: eventually climate change is going to be little bit like the aftermath of World War II, something that will either crush us as a society or we will rise to and it will allow us to transform our society.

There’s a lot of ways things that could lead to a worse future, including climate change, politics, and inequality, but you still describe yourself as an optimist.

You have to believe that we can make things better. ‘Why It’s Up to Us’ is the most important part of the book’s title. I think it’s time for us to stop believing in the divine right of capital, that it’s only natural for companies to want to extract as much profit as possible from every unit of work to screw their customers if that will make them richer. Give me a break, that doesn’t work, it’s not sustainable.

Christopher Michel

At times the book is a scathing attack on companies and the quest for more market value, which you describe as a system controlled by algorithims. Who is to blame for that? The companies? The financial markets?

We have these companies that think it’s ok to be hostile to their customers. I have a way of explaining this, in two parts. The first is the idea that, in some sense, systems like Google and Facebook are already artificial intelligences, just not the way we normally think of AIs. These are digital intelligence that incorporates human intelligence. We click links that inform and teach the platforms. It’s an extended digital collective brain. If that’s true then our financial markets are also one of these AIs too.

Financial markets are algorithmic systems, and they have an objective function. Thirty or forty years ago, we told them optimize for share price, to treat people as a cost to be eliminated. Executive compensation was aligned to the idea of making the share price go up regardless of the cost, which discouraged investment in the real economy of things and people. The shareholder capitalism system that we built really needs some deep rethinking.

So what precisely should we do to build this better future?

We have to break the alignment between management compensation and shareholder value. You could legislate to cap how much executives can be paid in stock, for example, it could be no more than 10% of the amount you distribute to the entire company. I don’t know want the right number is.

Switzerland tried something like this, but voters rejected the cap on executive pay.

“We should try and distinguish between gambling in the financial markets and true investment.”

We could clearly do a lot more with tax rates. We should try and distinguish between gambling in the financial markets and true investment. Maybe you do that simply by figuring out the real time horizon of an investment. There’s some interesting ideas on this, such as loyalty shares and Eric Reis’s long-term stock exchange where you get more voting power the longer you hold a stock. Policymakers need to get a lot better at learning in real time about what works and what doesn’t.

You acknowledge that the book is very US-focused, so how does the rest of the world fit into your vision?

The demographics of the world would suggest the future is not in the US or Western Europe. The choices that are made in other parts of the world are probably more important. There’s positives and negatives to that because the US and Western Europe have been the bastions of democracy and certain way of doing things, so it may be that the 21st century will develop into a very different type of culture. I hope the young people of Africa and Asia, as they grow up into prosperity, learn from the things we got wrong and build a better society. Hopefully we can help by injecting some of those ideas into the people that will own the 21st century, because I think those people won’t be us.