Translate with a script, not an agent
Why the blog builds its English version with a simple script instead of an LLM agent: it costs less, gives better results, and the post's voice survives intact.
We recently shipped automatic translation of posts into English. The temptation to spin up an LLM agent and let it rewrite the content is strong, but experience told us that wasn't the right path. Here's the real decision.
The script: one call, one post
The scripts/traducir-post.mjs script is not an agent. A Spanish post goes in, the English translation comes out: one API call per post, no tools, no loop. The prompt is tuned to the blog's voice: first person, plain Spanish, honest about the costs and free of marketing jargon. A literal translation flattens the post and turns it into corporate documentation; that's why the model is asked to rewrite sentences so they sound natural in English, to stay away from calqued syntax, and not to touch code, paths or comments outside the code block.
The agent that reads the repo costs an order of magnitude more and doesn't translate any better. The real asset isn't the code, it's the prompt: the voice, code byte for byte, comments yes. And the cost: each post runs a few cents on CheaperInference, versus a far more expensive call if the agent has to walk the codebase.
What gets translated and what doesn't
The script respects the structure byte for byte: same number of headings, same paragraphs, same lists, same tables, same order. Don't summarise, don't expand, don't reorder, don't add conclusions. Links keep the same URL; only the anchor text is translated. Code blocks, filenames, commands and paths go unchanged — byte-for-byte identical to the original. Comments inside the code do get translated, because in an English post a comment in Spanish grates, but without touching a line of logic.
What's left out is deliberate: date, status, author and source live in the Spanish file and aren't copied over. The translation generates its own frontmatter with a comment explaining this, for anyone who opens the English file and finds that those fields come from the original.
Cost and reliability
The approximate cost per post is $0.00X with CheaperInference Claude Sonnet 5.5, with an input/output token margin the script reports when it finishes. If the API returns 200 with stop_reason: "refusal", the script fails and the post isn't translated: the error is visible, not hidden. Same if max_tokens is reached: the post gets cut off and you have to raise the cap. It's a deliberate design: we used to have an agent that, reading the repo, failed silently and left posts in an in-between state; now either the translation completes or it doesn't ship, and the following week the --todos step picks up whatever is pending.
What we took away
A script is more predictable than an agent. One call, one input, one output. There's no state piling up, no session memory tilting one decision or another, and the prompt lives somewhere you can review and improve it without retraining a model.
The blog's voice is the asset, not the model. If the model changed tomorrow, the blog's voice would still be written in the prompt, and that's something you can adjust in one line. An agent that reads the repo picks up the voice by oscillation, not by design.
Cost matters. Each post costs a few cents. If the budget were tightened, the script would be switched off and posts would stay in Spanish until further notice. Nobody is depending on the translation running automatically every Monday: it's a luxury that can be withdrawn without breaking anything.
If someday the blog's voice or the model changes, the script would be adjusted to the new prompt. But in the meantime, it's still the simplest and cheapest way to have a bilingual blog.
If you have a use case where an agent performs better than a simple script, drop me a line: the lesson here isn't that agents are bad, but that the blog's case doesn't need them.