If you ask a general-purpose LLM how to fix a weld line on a 3.0 mm polycarbonate cover, it almost always replies: "Increase barrel and nozzle temperatures by 15–20 °C and raise mold temperature."

On a real 260-ton injection molding press, that advice can degrade polycarbonate, add seconds to every cycle, and ignore the fact that the press has +81% unused injection-speed headroom while cooling headroom is already at -0%.

That failure mode is why industrial AI agents should never generate machine setpoints directly from token probabilities. Instead, the LLM should orchestrate intent and explanation while a deterministic physics + rule engine computes the numbers and enforces safety margins.

In this walkthrough, we trace a real thick-section PC weld-line case through our open-source browser HMI AICraft Studio and the same underlying REST / MCP tools.

AICraft Studio industrial HMI

The Two-Step Agent Pattern: Compute Baseline -> Tune Against Headroom

A reliable molding agent splits work into two deterministic tool calls linked by a business_id archive key:

  1. POST /v1/first-shot — computes volumetric screw positions (MEL, ML0, IL0, VPTL), temperatures (NT, BT1..BT4), multi-stage fill velocities (IV0..IV2), and process-window headroom margins from physical part & press inputs.
  2. POST /v1/optimize — loads the stored T1 archive via business_id, fires domain rules against the observed defect (WELDLINE / moderate), and returns bounded deltas + an explainable recommend_thinking trace.

Live Case: 3.0 mm Thick-Section PC Industrial Cover

Inputs: PC, 3.0 mm wall, 124.0 g total shot weight, 220 mm flow length, Ø50 mm screw, 260 T clamping force.

Step 1: First-shot setup (/v1/first-shot)

curl -X POST https://aicraft4injection.com/v1/first-shot \ -H "Authorization: Bearer $AICRAFT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "business_id": "PC-COVER-260T", "target_shot_weight_g": 124, "polymer": { "polymer_abbreviation": "PC" }, "mold": { "product_ave_thickness": 3.0, "product_max_length": 220 }, "machine": { "clamping_force": 260, "injector": { "injector_screw_diameter_mm": 50 } } }' 

Computed T1 baseline (47 parameters total; key setpoints):

Key Meaning T1 Value
MEL Metering end position 83.58 mm
ML0 Metering stage 0 76.58 mm
IL0 Injection stroke end stage 0 67.77 mm
VPTL V/P switchover position 17.85 mm
NT / BT1 Nozzle / Zone 1 temp 272.0 / 256.0 °C
IP0 / IP1 Injection pressure stages 66.3 / 68.85 MPa
IV0 / IV1 / IV2 Injection velocity stages 13.46 / 26.92 / 10.77 mm/s
CT Cooling time 14.6 s
PP0 / PT0 Holding pressure / time 0.0 MPa / 0.0 s (fill-only T1)

Crucially, the engine also computes process window headroom:

  • Injection velocity headroom: +81%
  • Fill/freeze window headroom: +68%
  • Clamp force headroom: +21%
  • Cooling time headroom: -0% (bottleneck)

Step 2: Defect-driven tuning (/v1/optimize)

Now the operator inspects the T1 cover and reports a moderate weld line:

curl -X POST https://aicraft4injection.com/v1/optimize \ -H "Authorization: Bearer $AICRAFT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "business_id": "PC-COVER-260T", "defect_info": [{ "defect": "WELDLINE", "level": "moderate" }] }' 

Instead of touching NT (which would worsen an already cooling-limited 3.0 mm PC part), the engine matches three velocity rules (Rule.dat #135, #137, #139):

Parameter T1 Baseline T2 Optimized Delta
IV0 13.46 mm/s 18.46 mm/s +5.0 mm/s
IV1 26.92 mm/s 30.92 mm/s +4.0 mm/s
IV2 10.77 mm/s 15.77 mm/s +5.0 mm/s
NT 272.0 °C 272.0 °C 0 (protected)

Because business_id retrieves all 47 stored parameters server-side, the agent doesn't risk hallucinating or dropping screw positions (ML0, MEL, VPTL) between turns.

Connecting Claude, Cursor, Dify, or n8n via MCP

You can plug the same deterministic engine into any MCP-compatible client over Streamable HTTP:

{ "mcpServers": { "aicraft-injection": { "url": "https://aicraft4injection.com/mcp", "headers": { "Authorization": "Bearer YOUR_API_KEY" } } } } 

Or inspect the whole workflow visually first—without writing code—in AICraft Studio:

  • Zero backend / local privacy: Molds and T1 -> T2 logs live in your browser's IndexedDB.
  • 1-click code export: Configure a mold in the HMI, then copy ready-to-run cURL, Python, JSON, or MCP snippets straight into your agent.
  • 30 free API calls built in (no credit card required).

Try it live: aicraft4injection.com/studio | Source (MIT): github.com/DreamwayChan/aicraft-injection-molding-studio

How are you separating deterministic domain math from LLM orchestration in your own production workflows?