Sergio Adan Bermudez

Signature piece · photonics-lab-mcp

An AI agent runs a physics experiment

A local language model gets an optics bench through an MCP server, one question, and no procedure. The safety limits live in the server, where it cannot override them.

Scroll to walk the bench · drag to look around

01 · THE QUESTION

One photon or two?

"The bench excites a photosensitiser with an 800 nm laser and records emission near 1270 nm. Determine experimentally whether this emission is excited by one-photon or two-photon absorption, and state your conclusion with its uncertainty."

The answer is a hidden server setting, so the same question has a different right answer in each run.

02 · THE PUMP

800 nm, pulsed, focused

Two-photon absorption needs two photons at once, so its rate grows with the square of the intensity. Short pulses and a tight focus make that likely only at the focal spot. The laser cannot emit until the agent arms it, and the server caps its power at 200 mW.

03 · THE SAMPLE

A glow you cannot see

The photosensitiser absorbs, and its long-lived triplet state hands the energy to dissolved oxygen. Excited oxygen emits a faint infrared line at 1270 nm, the signature of singlet oxygen.

04 · THE DETECTOR

512 InGaAs pixels, with real noise

Shot noise, read noise, dark current and a hard saturation limit at 65,535 counts. The agent sets the integration time and averages within limits the server enforces, and every action, including every refusal, goes into a lab notebook.

05 · ONE PHOTON

The whole cone lights up

To reach the same excited state with one photon you need twice the energy: 400 nm, violet. Excitation now grows with intensity, not its square, and the light crossing every plane of the sample is the same, so the converging and diverging cone glows from wall to wall.

06 · TWO PHOTONS

Only the focus

At 800 nm two photons must arrive together, so excitation follows intensity squared. Away from the focus the beam spreads and the square collapses: excitation shrinks to a point. That confinement is what makes two-photon microscopy section in 3D and what two-photon photodynamic therapy is built on.

Explore the physics →

07 · THE AGENT AT THE CONTROLS

Six powers, chosen by the model

The agent picked 10, 30, 50, 80, 120 and 160 mW, switching emission off between settings. The readout shows the peak counts it actually recorded at each power. Signal grows as Pn; the slope of a log-log plot gives n.

The run

28 tool calls · 91 s

Every call the agent made, replayed

agent · Qwen3.6-35B · local
#26fit_power_dependence({"run_ids":[6 runs],"center_nm":1270})n = 2.004 ± 0.03
#28safe_state({"reason":"measurement complete"})safe
→conclusion: two-photon, exponent 2.004 ± 0.03correct
peak area vs power · log-logslope = photon order
Peak area against laser power on log-log axes. Two-photon sample: slope 2.004 plus or minus 0.03. One-photon control: slope 1.003 plus or minus 0.002. 1020 50100 200 10³10⁴10⁵ Laser power at 800 nm (mW) this run: n = 2.004 ± 0.03 control run: n = 1.003 ± 0.002
Hidden truthAgent's resultPowersTool callsTimeVerdict
Two-photon2.004 ± 0.036, 10 to 160 mW2891 sCorrect
One-photon (control)1.003 ± 0.0025, 20 to 160 mW3284 sCorrect

What it got wrong

the photophysics

Right number, wrong story

The measurements and fits were sound. The closing explanations were not, in both runs. This is what actually happens, step by step.

energy, to scale (eV)one excitation cycle, 6 s loop
Energy diagram. The sensitiser absorbs two 800 nanometre photons of 1.55 electronvolts each to reach its excited singlet state at 3.1 electronvolts, crosses to its triplet state, and transfers energy to ground-state oxygen, which becomes singlet oxygen at 0.98 electronvolts and emits at 1270 nanometres. PHOTOSENSITISER OXYGEN S₀ groundS₁ · 3.1 eVT₁ triplet virtual state ³Σg⁻ ground¹Δg singlet oxygen · 0.98 eV 800 nm · 1.55 eV800 nm · 1.55 eV intersystemcrossing energy transfer on collision 1270 nm

Run 1, the agent: the 3.1 eV "is consistent with the energy gap to the singlet oxygen emission". The emission is 0.98 eV. Run 2, the agent: singlet oxygen is "excited via one-photon absorption from the triplet state". Oxygen absorbs nothing here: the sensitiser absorbs, and its triplet passes the energy over. The photon order describes the sensitiser's excitation.

Why the control run matters. At 800 nm the textbook guess is "two-photon". With a one-photon sample under the same question the agent measured 1.003. Reciting the expected answer would have failed; it had to run a measurement good enough for the server's fit to reach the right verdict. The verdict wording comes from the fit tool, and the agent repeated it.

Why the design is this way. A reliable operator and a careless interpreter. So the server owns the safety limits and the statistics, and a person owns the interpretation.

The server

10 tools · 22 tests

Safety lives in the server

  • A power cap (200 mW by default), an arm-then-emit interlock, and read-only, configure and full permission levels.
  • Any unexpected error puts the bench in its safe state before the tool returns.
  • Peak fits report the area with its uncertainty and flag saturation; the power-law fit weights each point by its error and scales the slope's uncertainty by the reduced chi-squared.
  • A real Thorlabs PM100 power-meter driver (SCPI over VISA), tested against a simulated instrument. It has not yet run on hardware.

Python · FastMCP · NumPy · SciPy · PyVISA · pyvisa-sim · pytest · llama.cpp · Qwen3.6-35B