Connecting AI Agents to Live Discrete Element Simulations via the Model Context Protocol

Yusong Han, Ryosuke Uzuoka, Kyohei UedaarXiv 2026

TL;DR

Running physics simulations of granular materials—like soil or sand—usually means launching a multi-hour job, babysitting it for numerical explosions, and tweaking parameters by hand. This paper introduces an open-source interface built on the Model Context Protocol (MCP) that lets general-purpose AI agents plug directly into live, running simulations alongside a human engineer. Instead of firing off scripts blindly, the AI and human share the same console and viewport in real time, letting the agent inspect physics mid-flight, catch errors early, and autonomously calibrate complex soil models.

What Problem Does This Paper Address?

In geotechnical engineering, the Discrete Element Method (DEM) simulates soil from the ground up as thousands of individual colliding grains. It gives incredible insight into micromechanics, but it comes with two headaches:

  1. Calibration is tedious guesswork: You can’t directly measure grain-to-grain microscopic stiffness or rolling friction in a lab; you only measure bulk macroscopic behavior (like peak strength). Finding the right micro-parameters means running trial-and-error simulations until the virtual sand behaves like real sand.
  2. Long runtimes: Calculating forces across tens of thousands of contacts at every tiny time step takes hours or days.

While AI agents have started writing simulation input files, they typically treat the physics engine as a batch-processing black box: submit a job, go dark for hours, and read the output file when it finishes. While the simulation runs, the agent is blind—it can't check if the physics went haywire at step 100, pause to inspect internal forces, or collaborate with a human sitting at the graphical user interface (GUI). Furthermore, obscure simulation commands rarely appear in LLM training data, making hallucinated syntax a constant hazard.

Methods

Instead of building a specialized geotechnical AI framework, the authors leave the LLM untouched and build better infrastructure around existing DEM engines—specifically PFC (commercial) and YADE (open-source). They use the Model Context Protocol (MCP)—a universal "USB-C port" standard that lets any compatible AI agent discover and call external tools.

Figure 1: Architecture of the agentic loop. The modeler operates and reads the engine through its console and GUI; the AI agent operates and reads the same engine process through the MCP server. The modeler and the agent communicate in natural language. The modeler sees what the agent does to the engine in the console and the GUI, and the agent sees what the modeler does to the engine in the console history. The dashed frames mark the pre-agentic loop (top right) and the chatbot loop (top left). The MCP server and the bridge, drawn in green, are the contribution of this paper; the agent, its language model and the DEM engine are existing and are used as they are.

The architecture splits into two new components: an MCP server (offering seven minimalist tools) and a zero-dependency Python HTTP bridge living inside the physics engine's process:

  • Two Documentation Tools (query and browse): Declaring thousands of engine commands as individual tool schemas would instantly blow up an LLM's context window. Instead, the agent searches the official manual via simple BM25 keyword ranking (no vector databases or embeddings required) and browses categories level-by-level, reading less than 3% of the manual per session.
  • Five Execution Tools: execute_task, check_task_status, interrupt_task, and list_tasks manage long background runs, while execute_code acts as a live console for quick snippets.
Figure 2: Two ways to check the commands an agent writes. (a) Every engine command declared as a tool schema: each call is checked against its schema before it reaches the engine, and every schema occupies part of the language model’s context window. (b) The route taken in this study: the agent looks the command up with two documentation tools before writing it. A skipped lookup is caught by the engine’s own error message, which drives the agent to look the command up.

The clever engineering lies in the bridge's threading model. How do you let an AI inspect a simulation while C++ is furiously cycling through time steps without getting a distorted, "rolling-shutter" read across different steps? The bridge hooks into the engine's native cycle callbacks, briefly holding the simulation between two discrete time steps to execute the AI's read snippet on a consistent state before seamlessly resuming. Plus, every command the human types into the GUI console is echoed back to the agent's history, ensuring two-way situational awareness.

Datasets

  • Evaluation Data: Digitized laboratory stress–strain and volumetric curves from a classic drained triaxial compression test on dense Toyoura sand (Fukushima and Tatsuoka, 1984).
  • Open-Source Benchmark Archive: The authors release a complete Zenodo dataset containing the digitized lab curves, prompts, bridge logs, and full tool-call trajectories across 23 autonomous calibration sessions. No pre-training datasets were used.

Key Insights and Ideas

  • Agents don't lack intelligence; they lack live access: General-purpose coding agents already know how to debug scripts and apply soil mechanics principles (like Rowe's stress–dilatancy relation) to adjust parameters—once given live eyes and hands inside the engine.
  • Bidirectional human–AI awareness prevents disasters: During the live PFC test, a human researcher secretly typed console commands mid-session—first listing three particles, then overwriting memory with an older saved state! Without being told in chat, the agent spotted the console history, shrugged off the harmless read, verified its saved data curves weren't corrupted by the restore, and proactively coded a cycle-counter guard into its next script to prevent future human interference.
  • Deterministic physics tames stochastic LLMs: Even though LLMs are random—taking wildly different paths, writing custom wall servos, or tweaking different parameter combinations—the underlying mechanics funnel them to the same physical truth.
  • Live inspection saves wasted compute: Agents actively used execute_code during background runs to check wall velocities and particle contact counts, catching broken boundary conditions early and interrupting doomed runs rather than waiting hours for garbage results.

Key Results

  • Cross-Engine Calibration: Using Claude Opus 5.5, the agent calibrated four micro-parameters (porosity, contact modulus, sliding friction, and rolling friction) to hit three macroscopic targets within tolerance in 5 iterations on PFC and 6 iterations on YADE, with zero human help.
  • Multi-Model Evaluation: Tested across 7 LLMs (3 sessions each on YADE), 20 out of 21 sessions succeeded within the 12-submission budget, costing between $0.10 and $6.23 per session. Nineteen of the 21 final parameter sets converged into one tight region spanning just 15%–38% of the allowed parameter ranges. The only failed session was the single run that never consulted the documentation tools.
  • Tiny Model Compatibility: Even a 4-billion-parameter model (Qwen3.5-4B) running locally on a CPU passed a continuous-integration test operating all five execution tools.

Limitations and Future Work

  • Engine Requirements: The bridge requires an engine with an embedded scripting language (like Python) and explicit per-cycle callbacks to safely pause and read states between time steps.
  • Simplified Calibration Targets: The task only scored three scalar targets (secant stiffness, peak strength, and peak dilatancy), ignoring overall curve shapes, post-peak softening, and critical state behavior.
  • Future Work: The authors did not benchmark the AI's calibration speed or parameter quality against unassisted human engineers—leaving formal human–computer interaction studies with multiple human modelers as the next step.

Summary updated

BibTeX
@misc{han2026connecting,
  author = {Yusong Han and Ryosuke Uzuoka and Kyohei Ueda},
  title = {{Connecting AI Agents to Live Discrete Element Simulations via the Model Context Protocol}},
  year = {2026},
  eprint = {2611.33926},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.33926},
}
Figure