Upper endoscopy, also known as esophagogastroduodenoscopy (EGD), is a procedure that allows doctors to examine the lining of the upper part of the gastrointestinal tract, which includes the esophagus, stomach, and the first part of the small intestine, known as the duodenum. A thin, flexible tube called an endoscope, equipped with a light and camera, is used to view these areas and sometimes to take biopsies or perform other interventions.