Translation Agent: Agentic Translation with LLM Reflection Workflow

This repository profile is provided by osrepos.com, an open source repository discovery platform.

Translation Agent: Agentic Translation with LLM Reflection Workflow

Summary

Translation Agent is a Python demonstration of an agentic workflow for machine translation, leveraging large language models (LLMs) and a reflection process. This innovative approach aims to improve translation quality by having the LLM translate, reflect on its output, and then refine the translation based on its own suggestions. It offers significant customizability for style, idioms, and regional language variations, making it a promising direction for future translation technologies.

Repository Information

Analyzed by OSRepos on March 24, 2026

Use at your own risk

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.

Introduction

Translation Agent is a Python demonstration of an innovative agentic workflow for machine translation, developed by Andrew Ng and collaborators. This project leverages large language models (LLMs) to perform translations through a unique reflection process. The core idea involves an LLM first translating a text, then reflecting on its own output to identify areas for improvement, and finally using these self-generated suggestions to refine the translation.

This approach offers significant customizability, allowing users to easily modify the output's style (e.g., formal/informal), specify how to handle idioms and special terms, and even target specific regional language uses or dialects. While not yet mature software, Translation Agent is presented as a promising starting point for agentic translations, encouraging further discussion, experimentation, and open-source contributions in the field.

Installation

To get started with translation-agent, follow these steps. The Poetry package manager is required for installation.

  1. Install Poetry:

    pip install poetry
    

    For more detailed instructions, refer to the Poetry Installation Guide.

  2. Clone the repository and set up:

    A .env file with an OPENAI_API_KEY is required to run the workflow. See the .env.sample file in the repository for an example.

    git clone https://github.com/andrewyng/translation-agent.git
    cd translation-agent
    poetry install
    poetry shell # activates virtual environment
    

Examples

Once installed, you can use translation-agent in your Python projects:

import translation_agent as ta
source_lang, target_lang, country = "English", "Spanish", "Mexico"
source_text = "Hello, how are you?" # Example text
translation = ta.translate(source_lang, target_lang, source_text, country)
print(translation)

For a complete example script, refer to examples/example_script.py within the cloned repository.

Why Use It

Translation Agent presents a compelling alternative to traditional machine translation systems, primarily due to its high steerability and potential for superior translation quality in specific contexts. By integrating LLMs into a reflection workflow, it allows for granular control over translation nuances, such as stylistic choices, consistent handling of specialized terminology via glossaries, and adaptation to regional language variations.

Although its performance can vary, the project has shown instances of producing "fantastic results" that surpass commercial offerings. Furthermore, this agentic approach could serve as a valuable mechanism for automatically generating high-quality parallel text corpora, which can then be used to train and improve traditional, faster machine translation algorithms. The project actively invites the open-source community to explore extensions, including experimenting with different LLMs, developing glossary creation and usage strategies, and conducting more robust evaluations.

Links

Related repositories

Similar repositories that may be relevant next.

LLM Guard: The Security Toolkit for LLM Interactions

LLM Guard: The Security Toolkit for LLM Interactions

June 26, 2026

LLM Guard is an open-source security toolkit developed by Protect AI, designed to fortify the safety of Large Language Models. It offers comprehensive protection against various threats, including prompt injection, data leakage, and harmful language, ensuring secure and reliable LLM interactions.

llm-securityprompt-injectionlarge-language-models
AuditNLG: Auditing Generative AI for Trustworthiness

AuditNLG: Auditing Generative AI for Trustworthiness

June 25, 2026

AuditNLG is an open-source library from Salesforce designed to enhance the trustworthiness of generative AI language models. It provides state-of-the-art techniques to detect and improve factualness, safety, and constraint adherence in AI-generated text. This library simplifies the process of auditing AI outputs, offering explanations and alternative suggestions for problematic content.

PythonGenerative AIAI Safety
Odysseus: A Comprehensive Self-Hosted AI Workspace for Productivity

Odysseus: A Comprehensive Self-Hosted AI Workspace for Productivity

June 25, 2026

Odysseus is a powerful self-hosted AI workspace designed to integrate various AI-powered tools into a single platform. It offers functionalities for chat, agents, deep research, document management, email, and calendar, supporting both local and API models. This comprehensive solution aims to enhance productivity and streamline AI workflows in a private environment.

AI WorkspaceSelf-HostedPython
Headroom: Drastically Reduce LLM Token Usage for AI Agents

Headroom: Drastically Reduce LLM Token Usage for AI Agents

June 25, 2026

Headroom is an innovative context compression layer for AI agents, designed to significantly reduce token usage for LLMs. It achieves 60-95% fewer tokens across various inputs like tool outputs, logs, files, and RAG chunks, all while preserving answer accuracy. This powerful tool enhances efficiency and cost-effectiveness for AI interactions.

AILLMToken Optimization

Source repository

Open the original repository on GitHub.

View on GitHub
OS
OSRepos

Analysis and discovery of open source repositories. Find interesting projects and follow their updates.

Monitor your website with YourWebsiteScore

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of third-party repository code is at your own risk. Always review source code, dependencies, licenses, and security implications before running anything.

© 2025 OSRepos. Built with Nuxt 3 and lots of ❤️