The work is still test-tube-based but it could lead to "nano-clinics" which remain in the body, sensing illnesses and then treating them automatically.
The devices are so small that roughly a trillion of them can fit into a microlitre (a millionth of a litre).
The research is led by Ehud Shapiro from the Weizmann Institute in Rehovot and is published in the journal Nature.
"The devices are made of biological molecules - DNA; synthetic DNA molecules which we produced to our design, and a naturally occurring enzyme which cuts DNA," Professor Shapiro told BBC News.
One algorithm which the team tested is intended to diagnose prostate cancer.
It says that if levels of two messenger RNA molecules (PPAP2B and GSTP1) are lower than usual, and levels of two others (PIM1 and HPN) are elevated, there must be prostate cancer cells in the vicinity.
If this analytical/computational segment "decides" that cancer is present, it tells the second segment to release the third segment, which is an anti-cancer drug - in this case, consisting of so-called anti-sense DNA.
This has the effect of suppressing gene activity involved in the cancer.
"We demonstrated one particular 'computer' for diagnosing prostate cancer and another 'computer' for diagnosing small-cell lung cancer," Professor Shapiro said.
"We mixed them together in solution with various disease conditions, and the right computer diagnosed the right disease in all conditions."
So far these devices have only been trialled in test-tube solutions, and several decades of further work are needed before research could begin in humans.
But one day nano-scale devices like these could be used inside our bodies to protect against or treat cancers and other diseases.
"The best way to think about it is as a smart drug," suggested Professor Shapiro.
"Today, we bombard the body with drugs that go everywhere and operate everywhere and at any time.
"And what we designed is a smart drug that has some conditions encoded for its release; and it will be released and activated only at the right time and at the right location when a disease is diagnosed."
Dr Lesley Walker, director of cancer information at Cancer Research UK, said: "This work gives us some insight into the rapid progress being made in this field and the blurring of the divisions between the computer and natural sciences.
"They have moved the concept of the physician in the body - or more specifically here, an entire cancer team in the body - one whole step closer to reality.
"Inevitably, there's a huge amount of work to be done before molecular computers like this can be used to treat people.
"In the meantime, the global research effort to identify the perfect targets for treatment in different cancers will ensure that the biomolecular computers of the future have the best possible programmes."
By Richard Black
BBC science correspondent
BBC science correspondent