arXiv:2610.35349cs.CEOct 2026

Manuscript Offprint

arXiv:2610.35349

MarkovSim: an LLM Agent Harness with Bounded Context for Long-Horizon Computational Simulation

Yeui-Lung Lei, Wen-Bo Chen, Pan Zhang

ABSTRACT

Recent studies have applied large language model (LLM) agent systems to computational simulation workflows. Such workflows are long-horizon, so the information generated can exceed what an LLM can reason over at once, its context window. Context management is therefore essential, yet existing systems have either neglected it or treated it as a supporting mechanism rather than a subject of study. This paper presents MarkovSim, an LLM agent harness for long-horizon computational simulation, whose core is a context management scheme built into the workflow. The workflow record is written to a memory system with a predefined schema, and at workflow-defined boundaries, namely the state transitions of a finite-state machine a compact representation of the solution progress is constructed from it as the agent's context. Instantiated on finite element analysis and evaluated on six benchmark problems, MarkovSim passed 16 of 18 runs and corrected its own faults in both the solver operations and the model physics. The engineer, emulated by a proxy agent, was consulted only where engineering judgement was needed. The context remained bounded throughout every run, regardless of its length.

1 INTRODUCTION

Computational simulation has become foundational to both scientific discovery and engineering (Ferziger and Perić, 2002; Buehler, 2008; Belytschko et al., 2013). Methods such as finite element analysis (FEA), computational fluid dynamics (CFD), and molecular dynamics resolve the behaviour of complex systems across spatial and temporal scales, informing both scientific understanding and engineering design. Building a reliable simulation, however, remains the work of experts, from setting up the model to interpreting the results (Deotale et al., 2026). Such expertise is scarce, and expert time and attention have become a central bottleneck in simulation-driven research and design (Guo et al., 2026; Park et al., 2026).

Recent advances in large language models (LLMs) have opened new opportunities for automating such workflows, with agentic systems emerging as a particularly promising paradigm (Shin et al., 2025). An LLM agent employs an LLM as its reasoning core within a larger system, known as a harness, through which it acts on the environment with tools and adapts to what it observes (Yao et al., 2023). Such agents have seen remarkable success in software engineering, where coding agents such as Claude Code (Anthropic, 2026a) and Codex (OpenAI, 2026) are deployed at commercial scale, and encouraging results in other fields of science (M. Bran et al., 2024) and engineering (Du et al., 2026; Elrefaie et al., 2025; Qian and Shi, 2025).

Building on these advances, recent studies have begun exploring agent systems for computational simulation. In these systems, the agent operates the simulation software in place of the engineer, building the model, running the solver and reading the results. Many of these works have focused on CFD (Chen et al., 2024; Dong et al., 2025; Fan et al., 2026; Pandey et al., 2025; Xu et al., 2025; Yue et al., 2025). Considerable attention has also been given to FEA.

(Deotale et al., 2026; Hou et al., 2025; Mudur et al., 2025; Ni and Buehler, 2024; Park et al., 2026; Qi et al., 2025; Tian and Zhang, 2024). At finer scales, LLM agents have been explored for atomistic simulations such as molecular dynamics (Ghafarollahi and Buehler, 2025; Shi et al., 2025).

An agent system for computational simulation must meet two requirements. First, it must have domain expertise. Second, it must operate reliably over a long workflow. The second requirement arises because computational simulation is inherently long-horizon: the workflow is long, and how long it will be cannot be known before it is run. The workflow is long because a simulation is built in many inter-dependent steps, each conditioned on the model left by the previous one, and each step decomposes into several operations in the simulation software, so that even a simple FEA task calls for dozens of operations. The workflow actually executed is longer still, because trial and error is pervasive and its extent is not knowable in advance.

Existing research on these systems has concentrated on the first requirement, domain expertise. Since a general-purpose LLM may lack such knowledge (Brown et al., 2020), many studies have focused on grounding the agent with domain knowledge. Some supply knowledge of the physics, that is, of how a physical problem is turned into a sound numerical model and how its results are interpreted (Guo et al., 2026; Park et al., 2026; Qi et al., 2025). More commonly, they supply knowledge of the simulation software, in particular its API syntax and operating procedures (Chen et al., 2024; Deotale et al., 2026; Dong et al., 2025; Fan et al., 2026; Hou et al., 2025; Mudur et al., 2025).

The second requirement is harder to meet, because a long-horizon workflow generates more information than an LLM can reason over at once. As it works, an agent system accumulates a workflow history: past attempts and reasoning, information exchanged between agents, and external information drawn in for grounding. The state of the solution progress, that is, what has been settled and what remains, is embedded implicitly in this history, so the agent must reason over the whole history to decide the next action. However, the information an LLM can take in a single call, its context, is limited by a fixed context window, whereas the workflow history grows without bound. Two failure modes follow. When the history exceeds the context window, the workflow cannot proceed (Packer et al., 2024). Even before that limit, LLM performance degrades as the context lengthens (Hsieh et al., 2024; Liu et al., 2024). Operating reliably therefore depends on context management: deciding what information enters the context at each call, and in what form. In simulation agent systems, context management has so far been a component of the design, where present at all, rather than a subject of study (Section 4).

This paper presents MarkovSim, an LLM agent harness for long-horizon computational simulation. Its core is a context management scheme built into the workflow. The record of the workflow is written, as it proceeds, to a memory system with a predefined schema. At workflow-defined boundaries, namely the state transitions of a finite-state machine (FSM), a compact representation of the solution progress is constructed from this memory as the agent's context, while the rest remains available on demand. The name refers to the Markov property (Sutton and Barto, 2018), since the work ahead depends on the history only through this representation and what the agent explicitly retrieves from the memory. The harness is instantiated on the FEA software Abaqus (Dassault Systemes, 2023) and evaluated on six benchmark problems, three runs each. We examine the accuracy of the results and the context of the Execution Agent over each run. MarkovSim passed 16 of 18 runs, an 89% success rate, and the context remained bounded in every run, whatever its length. To our knowledge, this is the first report of the context at every call over complete simulation workflows.