Build a translator for text, links, and local files

They used Claude Code to make a translation agent that accepts pasted text, a web address, or a file and returns Chinese translations.

Done with Claude Code· Intermediate· Nov 2026

What they did
They built the tool in small passes, letting Claude Code create one working layer at a time: first a basic interface, then support for Doubao 1.6, then tools for fetching web pages and reading files, and finally a UI that showed tool status. A CLAUDE.md file instructed the agent to check and repair its own output, and they kept pasting current SDK examples into each round of prompting. When version 0.3 misbehaved, they reverted it and rewrote the prompt before trying again.
How it went
The finished agent could take a blog URL, load the homepage, identify the first two posts, and translate both into Chinese. It used three fetch calls. The author also said their page fetching is still rough and breaks on most sites.
Tips
Build in small steps and verify each layer before adding the next. If the agent will touch web pages or files, use a model that is already good at tool use and pause for approval before any saving or other irreversible action.

Try it yourself with Claude Code

Help me build a small translation agent in [framework or app]. It should accept either pasted text, a web URL, or a local file path, then translate the content into [target language]. If the input is a URL, fetch the page and extract the main text; if it is a file, read it; if it is plain text, translate it directly. Keep headings and basic structure where possible, write the translated result to [output file or destination], and stop to ask me before any action that would overwrite, save, submit, delete, or send anything. Start by implementing the simplest version, test it with [sample URL/text/file], show me the output, then wait for my approval before making the next change. After each step, tell me exactly how to run it locally.

Fill in the [brackets]. Agents can make mistakes, so review anything before it is sent, paid or deleted.

Read the original on baoyu.io ↗

Get 3 agent uses like this every morning

With the day's top AI news. Free, and one click to unsubscribe.