Bacteria programmed to spot tumours in the liver have been shown off at the Ted (Technology, Entertainment and Design) conference in Vancouver.
Tal Danino, a researcher at the Massachusetts Institute of Technology (MIT), described how he programmed the bacteria with genetic code.
The system could be developed to identify other cancers, he said.
So far the research has only been tested on mice.
The results will be published in Science Translational Medicine.
The mice are fed pre-programmed probiotic bacteria - a similar type to that found in some health-promoting yogurts.
The bacteria produce enzymes when they encounter a tumour which will, in turn, change the colour of urine.
So far, the system has proved accurate at detecting liver cancer.
"Liver cancer is hard to detect, and there really is a need for new technology to help spot it," Mr Danino told the BBC ahead of his talk.
Worldwide, liver was the second most lethal cancer in 2012, resulting in 745,000 deaths, according to the World Health Organization (WHO).
Mr Danino was the first of 21 Ted fellows - young researchers engaged in cutting-edge work - chosen each year by the non-profit Ted organisation. Their five-minute speeches kick off the conference which, for the second year running, is being hosted in Canada.
"There are more bacteria in the body than there are stars in the galaxy," Mr Danino told the Ted audience.
"It is a fascinating universe in our body and we can now program bacteria like we program computers."
But the intersection between biology and computer is still at a "very early stage", he said.
"We don't know what the exact impact will be," he told the BBC.
Bacteria may be particularly useful in the continuing battle against cancer.
Studies have shown that there are often large concentrations of bacteria inside tumours, especially intestinal ones, with some experts suggesting that the bacteria are hiding in tumours because they are places where they cannot be attacked by the immune system.
The next stage for the work Mr Danino is doing is to use the programmable bacteria to detect a range of other cancers and, perhaps eventually, offer treatments.