How to Integrate AI with T-FLEX: Ditching Chatbots for Controlled Agents
LLMs often "hallucinate" in closed systems such as T-FLEX CAD, producing code that looks syntactically plausible but is functionally wrong. The engineers built tflex_harness, a framework that drops chatbot abstractions in favor of strict control: local API search, C# code generation, compilation before launch, and controlled execution inside the CAD system. The result: the agent runs more reliably and makes fewer mistakes.
AI-processed from Habr AI; edited by Hamidun News
Attempts to embed large language models in engineering software such as T-FLEX CAD usually end the same way: the process crashes, the license hangs, the project gets rolled back. Engineers on Habr worked out why this happens and showed a practical way to fix it.
Why LLMs hallucinate in CAD
T-FLEX is not a web application. It is a closed system that works through DLL libraries and demands tight session control, exact API method names and matching data types. One error, and the system crashes.
LLMs, by their nature, give probabilistic answers. A model can generate code that looks plausible: the syntax is correct and the logic seems reasonable. But the details matter: a parameter may have the wrong type, a method name may contain a typo, or the code may reference a structure field that does not actually exist. In a web application, this puts an error on the page. In CAD, it crashes the process.
Engineers call this "hallucination": the model confidently gives a wrong answer. And when dozens of such attempts in a row fail, the usual approach stops making sense.
How tflex_harness works
Instead of connecting an LLM directly, the engineers built the tflex_harness framework. It is not a chatbot. It is a multilayer control system:
- Layer 1: language model — generates a text description of the task based on the user's request
- Layer 2: control loop — parses the LLM output and checks commands before they are sent to the CAD system
- Layer 3: local search over API documentation — the system suggests correct method names and parameter types to the model
- Layer 4: C# code generation and compilation — the LLM writes code, and the compiler checks it before any attempt to run it
- Layer 5: isolated execution — the code runs in a separate T-FLEX session, so errors do not crash the main process
The result: if compilation fails, the model sees the specific error and tries again. The agent learns. Most importantly, only verified, compiled code reaches the CAD system.
Dropping abstractions
Here is the key difference from typical AI solutions. tflex_harness rejects grand promises. Instead, the system works in concrete terms: the model cannot invent methods, and is forced to use only those registered in the API. The code does not exist only in the neural network's head; it is actually compiled. Errors are checked mechanically, not statistically.
This sounds like a limitation. In practice, it is the only way to trust the result.
What this means
Integrating LLMs into specialized software does not require the biggest model or the slickest interface. It requires predictability and control at every step. For CAD, CAM systems and engineering software in general, this approach opens up a new scenario: safe automation of engineering tasks without the risk of data loss or a license crash.
- Dec 2, 2026Ai2 Releases MolmoWeb2 Web Agents: 27B Model Solves 75.3% of Tasks
- Dec 2, 2026Amazon Releases Ergo Open Weights for Coding: 1.1 Trillion Parameters and 2,200 Tokens per Second
- Dec 2, 2026OpenAI Opens Dots Agent to ChatGPT Plus Subscribers With 10,000+ Plugins
- Dec 2, 2026FSK Group Has Launched 395 AI Agents in Six Months, with a 97.7% Success Rate
Key Questions Answered
Why LLMs hallucinate in CAD?
T-FLEX is not a web application. It is a closed system that works through DLL libraries and demands tight session control, exact API method names and matching data types. One error, and the system crashes. LLMs, by their nature, give probabilistic answers. A model can generate code that looks plausible: the syntax is correct and the logic seems reasonable.
How tflex_harness works?
Instead of connecting an LLM directly, the engineers built the tflex_harness framework. It is not a chatbot. It is a multilayer control system: Layer 1: language model — generates a text description of the task based on the user's request Layer 2: control loop — parses the LLM output and checks commands before they are sent to the CAD system Layer 3: local search over API documentation — the system suggests correct method names and parameter types to the model Layer 4: C# code generation and…
What are the key details on Dropping abstractions?
Here is the key difference from typical AI solutions. tflex_harness rejects grand promises. Instead, the system works in concrete terms: the model cannot invent methods, and is forced to use only those registered in the API. The code does not exist only in the neural network's head; it is actually compiled. Errors are checked mechanically, not statistically. This sounds like a limitation. In practice, it is the only way to trust the result.
Test Frontier LLMs & Autonomous Agents in One Workspace
Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.
Daily 60-sec AI Voice Brief + Weekly Production AI Agent Playbook
Listen to a 60-second AI news brief every morning and get a weekly hands-on playbook for shipping AI agents to production — tools, MCP servers and patterns that work. Curated by Jemal Hamidun, Head of AI at Alpina Digital.
