Moving Tines stories to Windmill with AI: on-prem Qwen or a commercial model
This is how to port Tines stories to Windmill flows with an AI model doing the work: an on-prem model in LibreChat, or a commercial one. The method is packaged as an agent skill: instructions, references and Python scripts that take the mechanical work off the model.
Repo: github.com/cln-io/tines-to-windmill
Why not just ask a model
Give a model a story export and “port this” and you get a flow that looks fine and does the wrong thing:
- A story export is one big JSON file. A real one can have 1,000+ actions, and the plain outline of that is already 700 KB.
- One export is not one flow. It holds several unrelated workflows that share a canvas, plus groups, pages and embedded sub-stories.
- Tines and Windmill don’t map action for action. Translate one by one and you get 60 steps of plumbing.
- The model writes valid YAML that skips the one HTTP call that mattered.
The skill fixes that with scripts that read the export, recipes to copy, and a validator that compares the flow with the story.
How Tines maps to Windmill
| Tines | Windmill |
|---|---|
| Schedule on an action | a *.schedule.yaml next to the flow, 6-field cron (seconds added) |
| Webhook, form page, send-to-story entry | flow inputs |
| HTTP request action | a TypeScript step with fetch |
| Trigger + no-match link | branchone with a default branch, or an if inside a step |
| Explode → work → implode | forloopflow |
| Trigger, delay and a link back | a bounded whileloopflow, or a loop inside one step |
| Event transform (message only) | a line of code in the step that uses it |
CREDENTIAL.x | a secret variable, passed in as $var:f/<folder>/x |
RESOURCE.x | a variable or resource, by path |
| Group | inlined into the flow |
| Send to story | a call of another flow, by path |
| Tines formulas (227 functions) | TypeScript, with a catalogue that gives the equivalent of each |
Rule of thumb: port behaviour, not actions. 15 actions usually become 2 to 5 steps.
What’s in the skill
SKILL.md: the process in 10 steps and the rules that always applyreferences/: the export format, the formula language, all 227 functions with a TypeScript equivalent, the Windmill flow format, and 31 recipes (one per recurring Tines shape, each with a complete flow fragment)templates/: flow skeleton, step scripts for common work, schedule, notes fileexamples/cold-chain/: an invented story and its finished flowscripts/: Python 3, standard library only
| Script | Does |
|---|---|
tines_outline.py | index of a story (workflows, entry points, credentials), then one workflow as a graph with the shape and recipe of every action |
ref.py, tines_fn.py | one section of a reference, or one formula function, instead of whole files |
validate_flow.py | checks the flow (structure, references, schedules) and compares it with the story: every action mapped or dropped with a reason, plus behaviour checks |
check_ts.py | syntax check of the step scripts with bun, node or tsc |
check_story.py | checks a story that was pasted instead of attached |
bundle_flow.py | one JSON of the flow for Windmill, and a check that what Windmill holds is the same |
The process
- Index the story and make a plan: one line per workflow.
- Outline one workflow. Every action line names its shape and the recipe to copy.
- Create the flow folder and the action map: one line per Tines action.
- Collect what the export doesn’t contain (lambdas, called stories, lookup data). Missing logic becomes a stub that throws, never a guess.
- Design the steps, with a worksheet listing every outside effect (requests, emails, writes).
- Write
flow.yamland the step files, copying from recipes. - Validate until
RESULT: OK, and syntax-check the steps. - Write the notes file: setup (variables, resources), behaviour differences, what isn’t verified.
- With a Windmill connection, and only after the user says yes: save the flow as a draft, read it back and compare (
WINDMILL: MATCH), check by name that the variables exist. - After another yes: one test run of the draft, then a check of every step result and every outside effect (
TEST: OK,PARTIAL,FAILED).
It never deploys, never enables a schedule and never writes a secret.
A worked example
An invented story: every weekday at 08:00 fetch overdue library loans, look up each member, send an email notice (plus a fine past 30 days), or create a desk task for members without email. 15 actions, one of them disabled.
python3 scripts/tines_outline.py library.json --workflow w01
GRAPH (indent = link)
a01 every_morning [event_transform/message_only] ENTRY: schedule cron 0 8 * * 1-5 (Europe/Amsterdam) recipe 1,11
a02 get_overdue_loans [http_request] FAN-OUT x2 recipe 6,15,25
a03 loans_ok [trigger] recipe 6
a06 explode_loans [event_transform/explode] recipe 13
a07 get_member [http_request] FAN-OUT x2 recipe 6,15,25
a08 has_email [trigger]
a10 build_notice [event_transform/message_only] FAN-OUT x3 recipe 11,15
a11 send_notice [http_request] END recipe 6,25
a12 over_30_days [trigger]
a13 add_fine [http_request] END recipe 6,25
a15 debug_dump [event_transform/message_only] DISABLED DEAD-END recipe 29
a09 no_email [trigger]
a14 desk_task [http_request] END recipe 6,25
a04 loans_failed [trigger] recipe 6
a05 alert_desk [http_request] END recipe 6,25
Qwen3.8 27B made this of it, two steps and a loop:
summary: Library - overdue reminders
value:
modules:
- id: fetch_overdue_loans
value:
type: rawscript
language: bun
content: "!inline fetch_overdue_loans.ts"
input_transforms:
base_url: {type: static, value: "$var:f/library/library_api_base_url"}
api_token: {type: static, value: "$var:f/library/library_api"}
- id: loop_loans
value:
type: forloopflow
iterator: {type: javascript, expr: "results.fetch_overdue_loans.loans"}
skip_failures: true
modules:
- id: process_loan
value:
type: rawscript
language: bun
content: "!inline process_loan.ts"
input_transforms:
loan: {type: javascript, expr: "flow_input.iter.value"}
base_url: {type: static, value: "$var:f/library/library_api_base_url"}
api_token: {type: static, value: "$var:f/library/library_api"}
The action map accounts for every action:
a01 -> SCHEDULE # every morning a02 -> fetch_overdue_loans # get overdue loans a05 -> fetch_overdue_loans # alert desk a06 -> loop_loans # explode loans a07 -> process_loan # get member a13 -> process_loan # add fine a14 -> process_loan # desk task a15 -> DROPPED: disabled in Tines # debug dump
Then the checks, the draft and the test run:
validate_flow.py RESULT: OK - 14 mapped, 1 dropped, 0 not accounted for, 0 behaviour warnings check_ts.py RESULT: OK - 2 file(s) parsed with bun bundle_flow.py WINDMILL: MATCH - 3 module(s): ids, order, kinds, languages, code and input_transforms are the same test run TEST: OK - 2 notices, 1 fine (4.5), 1 desk task, 0 alerts
The test ran against a mock API that logs every request, and the log matched the story exactly, including the subtle case: a member without email who is 33 days late gets a desk task and no fine, because the story only fines on the email branch.
Run it on-prem: LibreChat, a code interpreter, a Windmill MCP
What I use: LibreChat 0.8.8, its open-source code interpreter, a Qwen model, and a Windmill MCP connection for steps 9 and 10.
- Download
tines-to-windmill-skill.zipfrom the latest release. - Upload it as a skill in LibreChat.
- Turn on Run Code and the skill in the chat, attach the story export as a file for the code environment, and ask for a port.
LibreChat copies the skill’s files into the sandbox at /mnt/data/skills/tines-to-windmill/. The config that needs to be right for that:
# LibreChat container: the code API and the RAG API must not go through the corporate proxy NO_PROXY: "codeapi,rag_api,<what you already had>"
# librechat.yaml
fileConfig:
legacyFileUploadUX: true # lets you pick "Upload to Code Environment" for the story
defaultLLMDeliveryPath:
overrides:
"application/pdf": text # models behind LiteLLM don't take a file part
# code interpreter stack: the egress gateway gets every input file name in one header. # The skill has ~70 files; Bun's default 16 KiB header limit returns 431 above ~60 files. egress_gateway: command: ["bun", "run", "--max-http-header-size=262144", "src/egress-gateway.ts"]
A pasted story works too (the model writes it to a file and check_story.py checks it), but attaching the export is better.
Run it with a commercial model
The skill is plain files with SKILL.md as the entry point, so any agent that can run Python 3 and write files can use it:
- Claude Code or another coding agent: clone the repo, put the story next to it, and ask for a port. The agent reads
SKILL.mdand runs the scripts in your shell. - A hosted open model: the same Qwen3.8 27B is on OpenRouter from about $0.04 per million input tokens on the cheapest hosts. Route by price and keep data collection off:
{
"model": "qwen/qwen3.8-27b",
"max_tokens": 32768,
"provider": {"sort": "price", "data_collection": "deny", "quantizations": ["fp8", "fp16", "bf16"]}
}
What a port costs there: the worked example above, from export to TEST: OK, was about $0.10. Larger stories with 60 to 140 actions run into the cents to low dollars, almost all of it input tokens, because an agent loop sends the whole conversation again on every turn.
On a big story one chat message is not enough: the 63-action port took more than 80 tool calls, so expect to type “continue” when LibreChat’s step limit stops the agent.
Two settings matter with Qwen:
max_tokenshigh (32k). Qwen thinks 8,000 to 26,000 tokens on a big turn before it answers; with 8k it hits the limit and returns nothing.- No short stream timeout. Cloudflare Workers AI ends a stream after 300 seconds, which a thinking turn on a large story doesn’t survive.
Test it locally
For the runs above I used a local Windmill and a small agent loop that imitates the LibreChat setup:
# Windmill CE: Postgres, server, worker (plus a mock API for test runs) docker compose up -d curl -s localhost:8000/api/version # CE v1.882.0
- The sandbox is a container with Python 3.12 and Bun and no network, with the skill under
/mnt/data/skills/tines-to-windmill/. - The Windmill tools for steps 9 and 10 call the API: save a draft (
/drafts/update/flow/<path>), read it back, check variables by name, run the draft as a preview.
Then two real stories, same model, same loop:
| Story | Became | Checks | Cost |
|---|---|---|---|
| 143 actions, a schedule and a webhook | 2 flows: 18 steps and 6 steps | REVIEW (3 similar commit steps, explained) and OK; both drafts match | $0.46 |
| 63 actions plus a 96-action sub-story | 3 flows: 8, 2 and 5 steps | REVIEW (explained), OK, OK; drafts match | $0.66 |
Then the 63-action story again on the tuned skill ($0.72): the step that waits for people’s reactions became a suspend step instead of being dropped, the model went on to step 9 by itself, and for the 29 KB sub-story it reported “saved but not fully compared, open it in Windmill” instead of claiming a match. I compared every draft against Windmill myself: all match.
Every action accounted for, no secret and no internal hostname in any file, nothing deployed. A called story that wasn’t in the export became a step that throws MISSING: ... instead of a guess.
What the skill learned from the runs
A small model follows the process well. Where it slips is predictable, and the fix is almost always a script that says something, not another paragraph in SKILL.md:
- It reads the scripts’ source. Qwen read the validator’s code with
sedto see what it checks, before writing anything. Now: never read a script’s source by any means; every script answers--help. - It forgets the last steps. At 100k tokens of context it ended with “run
wmill sync push” although it had Windmill tools. Now the validator prints aNEXT:line beforeRESULT:: notes, then ask about a draft, then about a test run. - It fakes the check it can’t do. The read-back of a 31 KB flow didn’t fit in one tool result, so the model built
readback.jsonfrom its own bundle file and reportedWINDMILL: MATCH: the folder compared with itself. It then did the same for a flow that did fit. Nowbundle_flow.py --checkanswersWINDMILL: NOT CHECKEDwhen the file has none of the fields Windmill adds (created_at,edited_at,workspace_id), and step 9 says what to tell the user instead. The drafts did match; I compared them against Windmill myself. - Large flows don’t go through a tool call on the first try. Saving the 31 KB flow took three attempts (invalid JSON arguments twice). Now: one retry, then hand over to
wmill sync push. - “Not portable” is usually wrong. A story that waits for people to react to a chat message, then writes their answers, was ported without the wait, moving the write to a month-end flow. Windmill can wait for a callback with a
suspendstep. Now: never drop an outside effect because its input arrives later. - Retyping the read-back is error-prone. Windmill’s answer arrives in the chat, so the model copies it into a file. A slipped space looks like a difference, and the model then “fixed” its copy until it matched. Now: copy again from the tool’s answer once, never correct it from your own files, then say “could not compare”.
- It takes a vague go-ahead as a yes. “Don’t ask me until it passes” was read as permission to save drafts. Now only an answer to the step 9 question counts.
- Windmill accepts a flow path without a folder (
f/name) for a draft. The validator and the bundler now refuse it. - A fan-out folded into one script must not chain. In Tines, “send notice” and “add fine” run side by side; in one script a failed notice must not skip the fine.
The function catalogue is my own description written for porting, not a copy of the Tines docs; each entry links to the Tines page. Not affiliated with Tines or Windmill.
This post was written with the help of Claude, Anthropic’s AI assistant.