I have been adding AI agents to the scattering software I build. They share one design: the agent can act only through a fixed list of tools, and each tool runs the same tested code the buttons run; refined values and metrics come from that code, not from the model.

How the agents are constrained: the language model, local or cloud, can only send tool calls to a fixed list of agent tools in the browser. The tools check their inputs, ask for approval and can be undone; they call the engine and the data, which run locally, and read written skills. There is no tool for files, the shell, the web or code execution.
The tool list is the model's only way in.

Tool design

Six choices that run through the tools.

The tool list is the only way in

The model cannot reach the data or the engine directly. It can only call a fixed list of tools, and none of them reads files, runs a shell, browses the web or executes code.

A tool call is a button press

Each tool runs the same tested code as the page's own control (1,700+ tests in MATERIA alone), so the agent can do nothing the page cannot. MATERIA and NEXPLAN serve the same code to other agents over MCP.

Checked, approved, undoable

Every input is validated before a tool runs. In MATERIA and NEBULA3D a change waits for your approval, or runs in Auto if you choose, and every change can be undone.

Numbers come from code

The model chooses what to run and explains the result. Refined values and metrics come from tested code, never from the model.

Guardrails in code

Rules a prompt could forget are enforced in code, from correlation limits to a hard-limit veto. A failure on real data becomes a test that replays in CI.

Local or cloud models

With a local model (Ollama, LM Studio) nothing leaves the machine. With a cloud model, the conversation and the tool results go to the provider you choose.

What each agent does

Four scattering tools and one materials-screening experiment.

MATERIA MATERIA Copilot · MCP server

A Copilot beside a powder or PDF fit, on Claude or a local model, that works through the page's own controls. You approve each change or let it run in Auto; every change can be undone, and the engine, not the model, computes the refined values. An MCP server opens the same core to other agents.

NEBULA3D NEBULA Pilot

An agent beside every page of the 3D-ΔPDF console, on a local or cloud model. It grades each reduction stage from unit-tested metrics, checks the ΔPDF against the crystal's symmetry, and tunes the pipeline from a checked catalog; a trial past a hard limit cannot win.

RMCProfile Workbench AI Copilot (beta)

A chatbox on every page, on a local or cloud model, that answers questions about a reverse Monte Carlo run by calling the Workbench's own analyses; deterministic checks read each result. The Workbench is live; the Copilot is not deployed yet.

NEXPLAN (work in progress) 26 MCP tools

My personal SNS experiment planner serves its calculations to agents as MCP tools, with hand-off tools that write the next tool's inputs: an instrument file for MATERIA, symmetry operations and Bragg positions for NEBULA3D and the NeXus Viewer.

Athanor (exploratory) Closed-loop screening agent

An agent that proposes candidate compositions, screens them with physics-grounded surrogates and iterates, on local models by default. Compared with non-LLM baselines under the same relaxation cap, not matched total compute.

Case studies

From validation rounds on real data; each round fixed what it exposed.

MATERIA · neutron powder (D1A)

PbSO₄: why is the fit poor?

wR 12% → 3.7%

On the GSAS-II tutorial data, the Copilot's fit diagnosis found the missing peak asymmetry.

MATERIA · lab X-ray (Cu Kα)

Fluorapatite: is the cell right?

1 part in 10⁵

Once the cell check handled lab data (the Kα₂ doublet, a zero shift), its cell agreed with GSAS-II's refined cell to 1 part in 10⁵.

MATERIA · neutron powder, unpublished data

High-entropy AWO₄: what is the magnetic structure?

Same answer in every live run

The Copilot found the propagation vector, ranked the candidate magnetic space groups, and refined the moments with the nuclear model held. Repeated runs found the same k-vector, group and moment.

NEBULA3D · a measured 6/mmm volume

Does the ΔPDF keep the crystal's symmetry?

Six-fold partners → agree to rounding

A symmetry check exposed a pipeline defect: six-fold partners in the ΔPDF no longer agreed. Now they agree to rounding, a fix to the pipeline, not an agent result.

RMCProfile Workbench · two local models

Does the AI Copilot hold up on a real model?

5 of 6 and 4 of 6 fully right

Six questions on the demo run: every tool call was valid, and the runs exposed four bugs, now fixed. Both models rated every answer “achieved”, so trust the checks, not the verdict.

Security

What could go wrong, what limits it, and what is still open.

Risk
What limits it
Still open
The model takes an action nobody intended
A fixed tool list and checked inputs; approval and undo for every change.
Approval only helps if the person reads the card.
Data leaves the machine
With a local model nothing leaves, and the app sends no telemetry.
With a cloud model, the conversation and the tool results go to that provider.
Text in a loaded file steers the model
It can still only call the tools, changes need approval, and the chat renders no links, images or HTML.
Bounded, not prevented.
The API key or the app code is compromised
A static page with no server of mine; the key stays in the browser.
No independent security review yet.

Checked in the MATERIA source code, November 2026.

Limits

What this work has not shown yet.

  • Tested on real models, on scenarios written from real failures, 3 runs each. NEBULA Pilot passed 27/27 with Claude Sonnet 5.5 and Haiku 5.5, and locally 17/27 with qwen3:32b and 15/27 with gemma4:26b (2026-10-10). MATERIA Copilot (2026-10-11) passed 38/45 with Sonnet 5.5 and 36/45 with Haiku 5.5 on 15 powder and PDF scenarios. The RMCProfile Copilot's real-model test is still a spot check. These test my own scenarios; they are not accuracy claims.
  • A handful of datasets. The validation rounds cover a few real datasets, not a benchmark.
  • Exploratory work. Athanor is an early prototype.
  • Solo work. Personal open-source work by one developer; not peer reviewed.
  • A person decides. Guardrails limit what an agent can change, not whether its explanation is right. Check anything you publish against established tools.