Imagine a scientist spending hours carefully turning tiny knobs and adjusting mirrors just to get a crystal sample ready for an X-ray scan. It's tedious work, and it happens at nearly every synchrotron facility around the world. Now, researchers at Stanford University and SLAC National Accelerator Laboratory have created an AI that can do this job on its own.

In a study published in Nature Machine Intelligence, the team demonstrated an AI agent that autonomously prepares crystal samples for X-ray experiments at the Stanford Synchrotron Radiation Lightsource. Synchrotrons are massive research machines that accelerate electrons to produce incredibly bright X-rays, which scientists then use to peer at the atomic structure of materials, molecules, and even biological samples.

Zhantao Chen, the study's first author, led this work at SLAC and Stanford before becoming an assistant professor at the University of Texas at Austin. He and his colleagues built an AI that can observe what's happening during an experiment, think about what needs to be done next, and send commands to laboratory instruments to complete the sample alignment process.

"Our work demonstrates an agentic AI X-ray scientist that can autonomously align single-crystal samples at synchrotron X-ray beamlines," Chen told Phys.org. "This agent can query experimental status, reason about what's going on and what needs to be done, and then carry out the experiment toward successful sample alignment."

The team tested their AI using a Co₃Sn₂S₂ crystal sample mounted on a copper holder at beamline BL17-2 of the Stanford facility. The AI worked through the same steps a human scientist would: reading experimental logs, taking images with X-ray detectors, and performing motor scans to fine-tune the sample's position.

What makes this approach special is flexibility. Traditional automated systems need scientists to write detailed instructions covering every possible scenario, which is time-consuming and often incomplete. This new AI agent, powered by a large language model, can adapt when things change unexpectedly.

"This adaptability is especially important in real experiments, where unexpected situations are common," Chen explained. "Without it, traditional automation often requires countless hand-written if-else rules to cover different scenarios."

The researchers see this as a glimpse of how AI could transform scientific laboratories. Rather than replacing scientists, these tools could handle routine setup work, freeing researchers to focus on interpreting results and asking new questions. The team is now working to expand what their AI can do, potentially allowing it to handle entire experiments from start to finish.