Researchers have developed nanobots capable of releasing drugs inside a brain.

The nanobots were designed to make it easier to release drugs in the body at more effective rates, the researchers who created them say in a paper published on August 15, and the hope is that they will help treat schizophrenia, depression, and other mental disorders.

Researchers worked on this concept by creating DNA-based nanobots and injecting them into a cockroach’s brain. Then they taught an algorithm the difference between a human brain at rest and an active brain performing a simple task, like arithmetic. Once the two were combined, the nanobots were able to release drugs into the cockroach’s brain when a nearby person’s brain was active.

“Our working prototype highlights the potential of such a technology in managing disorders to which no effective treatment exists,” the researchers explain in their paper, “and could inspire advanced modes of control over biological molecules in the body even outside therapeutic contexts.” Yet they caution that this prototype is still just a “demonstration and proof of concept.”

Other researchers want to use technology to help diagnose those disorders by analyzing speech. It’s possible that patients of the future could be diagnosed with the assistance of artificial intelligence and treated with drug-dispensing nanobots that live in their brains. (With a doctor’s help, of course.)