whatisgithub

What is translation-agent?

andrewyng/translation-agent — explained in plain English

Analysis updated 2026-06-26

5,735PythonAudience · developerComplexity · 2/5LicenseSetup · easy

In one sentence

A Python tool by Andrew Ng that translates text using a three-step LLM loop: initial translation, self-critique, then revised output. Supports glossaries, tone control, and regional dialects like Mexican Spanish. Experimental, not production-ready.

Mindmap

mindmap
  root((repo))
    Translation Workflow
      Initial translation
      Self critique step
      Revised output
    Customization
      Glossary terms
      Formal or informal tone
      Regional dialect
    Tech Requirements
      Python
      Poetry
      OpenAI API key
    Limitations
      Experimental project
      Benchmark varies
      Not production ready
    Contributions
      Open source
      Community experiments
      Andrew Ng project
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Translate documents with consistent terminology by supplying a custom glossary of required terms.

USE CASE 2

Get translations in a specific regional dialect, such as Mexican Spanish instead of Castilian Spanish.

USE CASE 3

Experiment with LLM self-reflection to improve translation quality beyond a single-pass approach.

USE CASE 4

Prototype a translation pipeline for a product that needs tone or style control.

What is it built with?

PythonOpenAI APIPoetry

How does it compare?

andrewyng/translation-agentmartinblech/xmltodictklavis-ai/klavis
Stars5,7355,7355,734
LanguagePythonPythonPython
Setup difficultyeasyeasymoderate
Complexity2/51/53/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 30min

Requires Python, Poetry, and an OpenAI API key. Install dependencies with Poetry, set your API key, then call the translate() function with source language, target language, optional country, and text.

MIT license, free to use, modify, and share for any purpose, including commercial projects.

So what is it?

This is a Python demonstration of a three-step translation workflow that uses a large language model to improve its own output. The process works like this: the model first translates a piece of text from one language to another, then it reads back its own translation and writes a list of suggestions for how to make it better, and finally it produces a revised translation using those suggestions. The idea is that this back-and-forth reflection can catch errors that a single-pass translation would miss. One practical advantage of this approach over traditional translation software is that you can steer the output in ways that are hard to do otherwise. You can include a glossary of terms that must be translated consistently, specify a writing style (formal or informal), or tell it to use a particular regional dialect, such as Mexican Spanish rather than Castilian Spanish. That kind of fine-grained control is difficult to get from a typical translation system. The project was created by Andrew Ng as a personal experiment over several weekends, with help from a few collaborators who assisted with code cleanup. The README notes clearly that this is not mature software and that performance measured against standard benchmarks is sometimes competitive with commercial services and sometimes worse. The goal of releasing it is to encourage experimentation and open-source contributions rather than to offer a production-ready tool. To run it yourself you need Python, the Poetry package manager, and an OpenAI API key. Once installed, calling the translate function takes a source language, a target language, an optional country for regional tuning, and the text to translate. The code is released under the MIT license.

Copy-paste prompts

Prompt 1
Using the translation-agent repo by Andrew Ng, translate the following English text into formal Brazilian Portuguese, using this glossary: 'onboarding' = 'integração': [paste your text here]
Prompt 2
I want to use andrewyng/translation-agent to translate customer support emails from English to Japanese in a polite, formal tone. Show me how to call the translate function with the correct parameters.
Prompt 3
Using the translation-agent approach, translate this legal clause from English to French and explain what self-critique suggestions the model generated in the middle step: [paste clause here]
Prompt 4
Help me set up andrewyng/translation-agent locally with Poetry and an OpenAI key, then run a test translation from English to Mexican Spanish.
Prompt 5
Using andrewyng/translation-agent, translate this product description into Simplified Chinese and Italian at the same time, keeping the brand name 'Lumio' untranslated in both outputs.

Frequently asked questions

What is translation-agent?

A Python tool by Andrew Ng that translates text using a three-step LLM loop: initial translation, self-critique, then revised output. Supports glossaries, tone control, and regional dialects like Mexican Spanish. Experimental, not production-ready.

What language is translation-agent written in?

Mainly Python. The stack also includes Python, OpenAI API, Poetry.

What license does translation-agent use?

MIT license, free to use, modify, and share for any purpose, including commercial projects.

How hard is translation-agent to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is translation-agent for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.