Executing experimental tasks in both normal research laboratories and large-scale scientific facilities often requires extensive human supervision and remains a key challenge on the path to fully autonomous, artificial intelligence (AI)-driven science.

Here we demonstrate a large language model-driven agent that autonomously performs X-ray sample alignment on a synchrotron beamline by planning actions, executing instrumental commands, interpreting observations and iterating towards experimental goals.

Based on existing large language models with structured tool-use via the model context protocol, our AI X-ray scientist was guided and tested using an in-house-built virtual experimental setup that mirrors a six-circle diffractometer at an operational synchrotron beamline.

The agentic workflow developed in the virtual environment was directly deployed on a real beamline, where it correctly identified reference reflections and determined the orientation matrix, an essential first step in any type of single-crystal scattering experiment.

Our AI X-ray scientist responded effectively to unexpected experimental conditions, demonstrating adaptive problem-solving and readiness for addressing practical experimental situations.

Our agentic AI X-ray scientist was informed by physical knowledge and equipped with the necessary experimental tools via an MCP framework. The AI X-ray scientist is granted access to terminal input/output history, detector images and motor scan results.

We deployed the AI scientist on the beamline BL17-2 at the SSRL, SLAC National Accelerator Laboratory. Commands on the real beamline were relayed through a human operator for safety only — the human presence served purely as a passive safety intermediary, with no influence on the experiment’s outcome or the AI’s decision-making process.

For real-world experiments, we employed Anthropic’s Claude Opus 4 model.

Nat Mach Intell (2026). https://doi.org/10.1038/s42256-026-01261-5