Engineered biosensors detect specific oxygen, lactate and pH levels in organs to enable tropism of bacteria in vivo. Different organs, including the liver (L), spleen (Sp), small intestine (SI), large intestine (LI) and tumour (T), exhibit varying biochemical signatures (Supplementary Table 1). The schematic shows that bacteria programmed to sense pH and oxygen enhance bacterial colonization in the small and large intestine, respectively. Bacteria with multiplexed lactate and oxygen AND logic gate sensing grow selectively within the tumour microenvironment.