Applied AI / Intelligent Automation
Teaching a local LLM to write production UiPath code
AnnaTech delivery toolchain, applied on enterprise engagements
- lines of knowledge-injection spec
- 2,064
- static validation check classes
- 8
- parameters, locally hosted open-weight model
- ~30B
- offline - no code leaves the network
- 100%
Architecture at a glance
Context
Large language models write plausible-looking UiPath XAML that UiPath Studio rejects: hallucinated activities, broken namespace declarations, duplicate internal identifiers, malformed selectors. Teams either give up on LLM-assisted delivery or burn the savings fixing generated code by hand.
We wanted the speed of LLM code generation for RPA delivery - without sending enterprise process definitions to a cloud model.
Constraint
Client workflow code describes internal systems, credentials handling and business rules; it cannot leave controlled infrastructure. That rules out frontier cloud models. Local open-weight models are safe to use but need engineering around them to reach production-grade output.
Architecture
Three components. First, a 2,064-line knowledge-injection specification that teaches the model the ground truth: verified activity catalogs, package dependency maps, selector grammar, framework contracts, an error encyclopedia of known failure modes.
Second, a scaffolder that emits known-good project boilerplate - namespaces, imports, framework contracts - so the model only generates the activity body, the part it is actually good at.
Third, a static validator covering eight check classes (namespace and prefix resolution, element whitelists, selector syntax, variable declaration and reference tracking, sub-workflow invoke-contract matching, dependency coverage and more). It emits machine-readable path:line findings that are fed straight back to the model for targeted retries, plus a deterministic fixer for known corruption classes such as double-encoded entities and duplicate identifiers.
Outcome
A locally hosted open-weight model in the 30B class now produces UiPath workflows that pass full static validation before Studio opens - generation, linting and repair all inside the network. The same validator lints human-written workflows in code review, so the investment pays off twice.
From the workbench
$ python uipath_validate.py --project ./GeneratedProcess Process.xaml:214: ERROR UNDECLARED-VAR reference 'dtResults' is never declared Process.xaml:389: ERROR INVOKE-CONTRACT 'GetEquipment.xaml' expects In 'Input' (Dictionary) — not passed Main_Entry.xaml:41: WARN UNUSED-VAR 'strTemp' declared but never referenced 2 errors, 1 warning -> findings returned to the model for a targeted retry $ python uipath_validate.py --project ./GeneratedProcess # pass 2 0 errors, 0 warnings — Studio-ready
Illustrative excerpt. Output format, rule classes and the retry loop are exactly as delivered.
More work
Related case studies
Intelligent Automation / SAP
Calibration certificates into SAP DMS at 50,000 documents a year
Applied AI / Document Intelligence
AI validation of US tax-exemption certificates across seven state form families
Intelligent Automation / Security
Unattended automation under mandatory MFA: 8-12 prompts down to 2
Talk to the person who will actually build it
One architect, end to end: scoping, architecture, delivery, operations. Write a paragraph about your problem and you will get an engineering answer, not a sales call.