Beyond Executable Models: The Pufibara Agent Harness and the Modelica Agent Workflow Benchmark for Physical System Modeling
Abstract
AI agents are increasingly used for simulation-driven engineering. Physical system modeling presents different requirements from general-purpose code generation in software engineering, because correctness depends not only on syntax and executability but also on physical consistency and scenario-dependent behavior. We study this challenge in Modelica, an equation-based modeling language in which a model may compile and simulate while still violating its intended physics or engineering requirements. Across successive revisions, an agent may lose track of requirements or rely on simulation evidence produced by an outdated candidate. To address this challenge, we present Pufibara, an agent harness that maintains persistent engineering state across revisions, associates execution and simulation evidence with the candidate that produced it, and makes submission an explicit agent action. To evaluate end-to-end Modelica agent workflows, we also propose a source-grounded method for constructing realistic and independently evaluable tasks. We use this method to build the 232-task Modelica Agent Workflow Benchmark, spanning Model Repair, Model Generation, and Model Tuning. Each submitted candidate is scored by a benchmark-owned evaluator outside the agent loop. We compare Pufibara with Claude Code as complete harnesses under two matched large language model (LLM) backends. With DeepSeek v4 Flash, Pufibara passes 202 tasks, compared with 185 for Claude Code. With Claude Sonnet 5, Pufibara passes 202 tasks, compared with 187 for Claude Code. Under the repository-reported token accounting, Pufibara records 76.4%-82.5% lower logical-token totals. Its sequential runtime is 6.1%-58.4% lower. These findings show that, even under matched LLM backends, complete agent harnesses can differ substantially in both task success and resource use for physical system modeling.
Figures & tables
| Workflow | Tasks (E/M/H) | Agent objective | Independent evaluation |
|---|---|---|---|
| Repair | 132 (21/56/55) | Repair a faulty model to satisfy the task specification | Interface preservation, model checking, and successful simulation |
| Generation | 50 (2/10/38) | Construct a model from an engineering brief | Structural requirements, model checking, simulation, and behavioral contracts |
| Tuning | 50 (4/24/22) | Tune permitted parameters toward behavioral targets | Parameter validity, successful simulation, and scenario-dependent response metrics |
| Total | 232 (27/90/115) |
| Primary domain | Repair (132) | Generation (50) | Tuning (50) | Total (232) |
|---|---|---|---|---|
| Electrical, magnetic, and electromechanical | 57 | 11 | 23 | 91 |
| Thermal-fluid, building, and process systems | 57 | 20 | 17 | 94 |
| Mechanical and multibody | 9 | 8 | 10 | 27 |
| Control, signal, and hybrid dynamics | 9 | 11 | 0 | 20 |
| Dimension | Configuration |
|---|---|
| Systems | Pufibara and Claude Code under DeepSeek v4 Flash and Claude Sonnet 5 |
| Matched conditions | Same backend, tasks, Modelica environment, and evaluator |
| Execution | One fresh isolated run per task, executed sequentially |
| Measures | Task pass count, logical-token use, and sequential wall-clock runtime |
| (a) DeepSeek v4 Flash | ||||
|---|---|---|---|---|
| Workflow | Harness | Passed | Tokens (M) | Runtime (h) |
| Repair | Pufibara | 130/132 | 39.8 | 4.07 |
| Claude Code | 124/132 | 227.0 | 9.78 | |
| Generation | Pufibara | 35/50 | 17.0 | 2.34 |
| Claude Code | 27/50 | 81.1 | 2.49 | |
| Tuning | Pufibara | 37/50 | 22.9 | 3.56 |
Appendix figures & tables2 assets
Supplementary material from the paper’s appendix.
Appendix
| Workflow | Main wall-time limit | Verification grace | Max agent turns | Max simulations |
|---|---|---|---|---|
| Repair | 900 s | 0 s | 100 | – |
| Generation | 900 s | 120 s | 100 | – |
| Tuning | 900 s | 120 s | 100 | 100 |
| Logical category | Native usage fields |
|---|---|
| Uncached input | input_tokens , prompt_tokens |
| Cache creation | cache_creation_input_tokens , cache_write |
| Cache read | cache_read_input_tokens , cache_read |
| Output | output_tokens , completion_tokens |
LLM Agent Harnesses
LLM agent harnesses are the software and runtime systems that organize an agent’s tools, context, state, execution, and safeguards.
See all 387 papers