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 study provides a step towards autonomous operation across diverse experimental environments at large-scale scattering facilities.
Published: 01 July 2026
DOI: https://doi.org/10.1038/s42256-026-01261-5
Abstract
The agent autonomously sequences, interprets and adapts experimental actions through iterative tool use rather than executing a fixed prescripted workflow. Deployment demonstrated on a real X-ray beamline at the Stanford Synchrotron Radiation Lightsource (SSRL) at SLAC National Accelerator Laboratory.
Key methodology
The AI X-ray scientist was informed by physical knowledge and equipped with experimental tools via an MCP framework. It was granted access to terminal input/output history, detector images and motor scan results. The setup uses a six-circle diffractometer with six degrees of freedom: two detector motors (δ and ν) and four sample motors (ϕ, χ, η and μ).
In virtual experiments using the beamline simulator, all steps are carried out automatically without human intervention. For the first real-beamline demonstration on BL17-2 at SSRL, the AI autonomously generated experimental commands, but execution was relayed through a human experimentalist solely to satisfy facility safety requirements — commands were executed without modification.
Results
The team showcased capabilities by asking the agent to determine the orientation matrix of a randomly aligned single-crystal sample — an essential prerequisite in scattering experiments. The magnetic Weyl semimetal Co3Sn2S2 was used as the example material.
Benchmarking compared agentic AI models on orientation estimation and lattice parameter prediction. The agent demonstrated autonomous sample alignment at SSRL, including adaptation to unexpected motor offsets during real experimental operation.
Rather than presenting new learning mechanisms or agentic AI architectures, this study centres on developing and deploying existing reasoning-capable LLMs for closed-loop execution of a concrete experimental task at a synchrotron facility.