On a recent rainy Tuesday afternoon, I made my way from Manhattan to Brooklyn to visit a farm. And I was feeling thankful it was an indoor farm.

I had heard about this company, Square Roots, that was taking indoor hydroponic farming to a new level by introducing high technology, including machine learning, into the farming process.

I entered a large, aging complex that once housed and produced ammonia for the Pfizer company. It had been mostly abandoned for decades and is just now starting to fill its abundant space with startups. Square Roots occupies a small office on the third floor.

I met the company’s CEO and co-founder, Tobias Peggs, who told me he sees Square Roots as an “urban farming accelerator.” His partner is Kimbal Musk (brother of Tesla titan Elon Musk), and together they co-founded the company three years ago to support “real food” entrepreneurs as they produce nutritious and GMO-free greens using modular, indoor, state-of-the-art urban farms.

Peggs came to the US from his native UK with a PhD in Artificial Intelligence and worked in tech where he met Musk in 2006. Musk made a life-changing decision after he broke his neck in a skiing accident in 2009. He decided to devote his life to bringing “real food” to everyone. He partnered with Peggs, who had also worked for Walmart and had seen first-hand how millions of people, especially those in the  biggest cities, were at the mercy of industrial food being shipped thousands of miles from around the world. He’s argued that this leaves people disconnected from their food and those who produce it. This leads to a loss of community and adverse health effects, he says.

There’s a certain genius to the Square Roots approach to indoor farming. Choose a crop. Determine which particular climate in the world produces the best quality of said crop. Study its climate at peak growing season, its soil nutrients, CO2 level, daily temperature throughout the day, humidity, sunrise and sunset times, and then artificially replicate those conditions in a shipping container. The result is continuous peak growing season 24/7.

Using machine learning, the company can monitor the results and automatically tweak the system to optimize them. Given the conditions are in an enclosed system that isn’t affected by the outside environment, it can conceivably share the information and adjustments instantaneously with boxes around the world. The scalability is infinite.

The company also boasts a training program for a next generation of farmers that will tend to this new method of farming. Yes, despite the automation and AI, we will still need real people to tend to the plants. Square Roots runs cohorts over a 12-month period, not only training them in the technology but in all aspects of what food sales and distribution will look like in the future. He claims a majority stay on after the one-year period as they will be needed for the company’s ongoing expansion. As for those that move on, Peggs is happy that they will continue to spread the gospel of the ongoing  food revolution.

For the moment, the crops produced are ones with low biomass (leafy greens versus, say, zucchinis). The reason for this is economics. The higher the biomass, the more energy needed and the higher the cost.

The example I was shown was Italian Genoa basil, which Peggs claims is the world’s best. Using non-GMO seeds from a Dutch supplier, and having studied the climate and soil around the Genoa region, they produce two crops per week, all year long. Additionally, they deliver the product to the consumer on the same day of harvest. Currently, from the 10 shipping containers in its parking lot, Square Roots delivers to 100 retail stores in a five-square-mile radius with near-zero environmental impact distribution.

Being the Italian food snob that I am, I insisted on tasting Square Roots’ product. I use a lot of basil in my tomato sauces, so I felt I was worthy to judge. It was a deep green basil, unlike what I find at my local grocery store back home and it was very flavorful. Test passed.

I must say, I left the interview inspired. Like Kimbal’s brother Elon, I am a bit suspicious about the dangers of AI. However, this was a perfect example of how AI and technology in general may help solve the problem of producing food for a growing world population in an environmentally responsible manner.