Translate Factory
testA multi-agent system for literary book translation (PDF/EPUB/FB2 → MD/EPUB/PDF).
Translate Factory is a multi-agent system for literary book translation (PDF / EPUB / FB2 → MD / EPUB / PDF) that turns raw text into a cohesive, stylistically consistent work in another language.
Unlike a single “universal” model, Translate Factory uses a chain of specialized agents, each responsible for a specific pipeline stage. This simultaneously addresses three key translation challenges:
- preserving the author's voice and rhythm,
- consistent names and terms across the entire book,
- accounting for cultural and contextual layers in the text.
The system works with long context, maintains narrative continuity between sections, and controls translation quality at the book level, not just individual fragments.
How it works
At the core is an agent graph through which book text passes sequentially: from parsing to final assembly.
Each agent receives not only the current text fragment but also shared context:
- Style Card (author style),
- Glossary (names and terms),
- Rolling Summary (accumulated plot context).
This lets the system “remember” what happened earlier and maintain a unified style and meaning across the entire book.
Pipeline agents
Preparation
-
parse_fileParses and cleans the source file (PDF / EPUB / FB2 → Markdown). Removes artifacts and normalizes text structure. -
analyze_bookCreates a Style Card — a formal description of the author's style: genre, tone, rhythm, POV, dialogue density, and key techniques. -
extract_glossaryBuilds an initial glossary: characters, locations, terms, and recurring author expressions. -
chunk_bookSplits the book into semantic sections (chapters / scenes / paragraphs) without breaking dialogues or meaning blocks.
Main translation loop
For each section, the following cycle runs:
-
route_modelChooses the optimal LLM based on genre and language pair (e.g. literary fiction → Claude, complex languages → GPT-4o). -
translate_chunkPerforms translation using:- Style Card
- current glossary
- previous context (rolling summary)
-
adapt_cultureAdapts idioms, cultural references, humor, units of measure, and stylistic nuances for the target language. -
update_glossaryUpdates the glossary with new terms and tracks translation conflicts. -
human_review(optional) Involves a human when terms conflict — the system pauses and waits for a decision. -
update_summaryUpdates the rolling summary — a compressed view of prior events to preserve context.
Completion
-
assembleJoins translated sections into a single text, checking seams between them (dialogues, duplicates, transition logic). -
exportExports the result to MD / EPUB / PDF and savesglossary.jsonas a separate artifact.
Why this works better than ordinary translation
-
Context is not lost Each section is translated with the full prior story in mind.
-
Term consistency The glossary is maintained automatically and checked for conflicts.
-
Style preservation The Style Card pushes the model to write “like the author”, not just translate literally.
-
Cultural adaptation The translation reads naturally for native speakers, not as a calque.
-
Pipeline reliability Checkpointing lets you resume translation from any point after a failure.
-
Human in the loop Critical decisions (e.g. key term translations) remain under human control.
Stack
- Backend
- Python
- LangGraph
- Marker
- Qdrant (Vector Storage)