In a study carried out over the summer, a group of volunteers drank a white, peppermint-ish concoction laced with billions of bacteria. The microbes had been engineered to break down a naturally occurring toxin in the blood.

The vast majority of us can do this without any help. But for those who cannot, these microbes may someday become a living medicine.

The trial marks an important milestone in a promising scientific field known as synthetic biology. Two decades ago, researchers started to tinker with living things the way engineers tinker with electronics.

They took advantage of the fact that genes typically don’t work in isolation. Instead, many genes work together, activating and deactivating one another. Synthetic biologists manipulated these communications, creating cells that respond to new signals or respond in new ways.

Until now, the biggest impact has been industrial. Companies are using engineered bacteria as miniature factories, assembling complex molecules like antibiotics or compounds used to make clothing.

In recent years, though, a number of research teams have turned their attention inward. They want to use synthetic biology to fashion microbes that enter our bodies and treat us from the inside.

The bacterial concoction that volunteers drank this summer — tested by the company Synlogic — may become the first synthetic biology-based medical treatment to gain approval by the Food and Drug Administration.

The bacteria are designed to treat a rare inherited disease called phenylketonuria, or PKU. People with the condition must avoid dietary protein in foods such as meat and cheese, because their bodies cannot break down a byproduct, an amino acid called phenylalanine.

As phenylalanine builds up in the blood, it can damage neurons in the brain, leading to delayed development, intellectual disability and psychiatric disorders. The traditional treatment for PKU is a strict low-protein diet, accompanied by shakes loaded with nutritional supplements.

The researchers are now going forward with a trial on people with PKU and expect to report initial results next year.

Tal Danino, a synthetic biologist at Columbia University, said that a number of other researchers are working on similar projects, but no one has moved forward as fast as Synlogic. “They’re leading the charge,” he said.

One of Synlogic’s co-founders, James J. Collins, a synthetic biologist at M.I.T., published one of synthetic biology’s first proofs of principle in 2000.

He and his colleagues endowed E. coli bacteria with a way to turn a gene on and off when they were exposed to certain chemicals — “like a light switch for genes,” Dr. Collins said in an interview.

“I think anywhere there are bacteria in the body is an opportunity to engineer them to do something else.”

In the mid-2000s, microbiologists began charting our inner menagerie of microbes, the vast diversity of organisms that live inside healthy people. The microbiome is continually carrying out complex biochemistry, some of which helps shield us from diseases, scientists found.

Synthetic biologists soon began wondering whether they could add engineered bacteria to the mix — perhaps as internal sensors for signs of disease, or even as gut-based factories that make drugs the body needs.

“You can’t overestimate the impact of the microbiome work,” said Jeff Hasty, a former student of Dr. Collins who now runs his own lab at the University of California, San Diego. “That, in a nutshell, changed everything.”

Dr. Collins and Timothy K. Lu, another synthetic biologist at M.I.T., co-founded Synlogic in 2013, and the company began looking for diseases to take on. One of their picks was PKU, which affects 16,500 people in the United States.

Drugs have recently become available that can drive down levels of phenylalanine. But they only work in a fraction of patients, and they come with side effects of their own.

“The current tools that we have available are not good enough,” said Christine S. Brown, the executive director of the National PKU Alliance.

For years, researchers have explored treating PKU with gene therapy, hoping to insert working versions of the defective gene, called PAH, into a patient’s own cells. But so far the approach has not moved beyond studies in mice.

To Synlogic, PKU looked like a ripe opportunity to use synthetic biology to create a treatment that might gain government approval.

Company researchers selected a harmless strain of E. coli that’s been studied for more than a century. “Most people have healthy, good E. coli in their intestinal tracts,” said Paul Miller, the chief scientific officer of Synlogic.

The researchers inserted genes into the bacteria’s DNA so that once they arrived in the gut, they could break down phenylalanine like our own cells do.

One of the new genes encodes a pump that the bacteria use to suck up phenylalanine around them. A second gene encodes an enzyme that breaks down the phenylalanine into fragments. The bacteria then release the fragments, which get washed out in urine.

The Synlogic team wanted the microbes to break down phenylalanine only in the right place and at the right time in the human body. So they engineered the bacteria to keep their phenylalanine genes shut down if they sensed high levels of oxygen around them.

Only when they arrived in a place with little oxygen — the gut — did they turn on their engineered genes.

To test the bacteria, the researchers created mice with the mutation that causes PKU. When the mice received a dose of the bacteria, the phenylalanine in their blood dropped by 38 percent, compared with mice without the microbes.

The researchers also tried out the bacteria on healthy monkeys. When monkeys without the microbes ate a high-protein diet, they experienced a spike of phenylalanine in their blood. The monkeys with engineered bacteria in their guts experienced only a gentle bump.

For their human trial, Synlogic recruited healthy people to swallow the bacteria. Some took a single dose, while others drank increasingly large ones over the course of a week. After ingesting the bacteria, the volunteers drank a shake or ate solid food high in protein.

On Tuesday, Synlogic announced that the trial had demonstrated people could safely tolerate the bacteria. In addition, the more bacteria they ingested, the more bits of phenylalanine wound up in their urine — a sign the bacteria were doing their job.

The next step will be to see if the microbes can lower phenylalanine levels in people with PKU.

“I’m amazed at how fast we got to where we are,” said Dr. Collins, who was not involved in Synlogic’s PKU research.

In July, Dr. Danino and his colleagues published a review in the journal Cell Systems, cataloging a number of other disorders that researchers are designing synthetic microbes to treat, including inflammation and infections.

Dr. Danino and Dr. Hasty are currently collaborating on another project: how to use synthetic biology against cancer.

One huge challenge in developing drugs for cancer is that they often fail to penetrate tumors. But microbiome researchers have discovered that natural bacteria regularly infiltrate tumors and grow inside them.

Now scientists are engineering bacteria that can also make their way into tumors. Once there, they will unload molecules that attract immune cells, which the researchers hope will kill the cancer.

“I think anywhere there are bacteria in the body is an opportunity to engineer them to do something else,” said Dr. Danino.

Carl Zimmer writes the “Matter” column. He is the author of thirteen books, including “She Has Her Mother's Laugh: The Powers, Perversions, and Potential of Heredity.” @carlzimmer•Facebook

A version of this article appears in print on , Section D, Page 1 of the New York edition with the headline: Retooling Bacteria to Cure Disease. Order Reprints | Today’s Paper | Subscribe