Translation Assistant

Translation Agent for correcting and translating text

agent
translation
mastra
google

Install

npx tsai-registry add translate-agent

Exports

  • translationAgent

📁 Files of items

index.ts src/mastra/registry/agents/translate-agent/index.ts

typescript
import { translationAgent } from './translate-agent'

export { translationAgent }

translate-agent.ts src/mastra/registry/agents/translate-agent/translate-agent.ts

typescript
import 'dotenv/config';
import { Agent } from '@mastra/core/agent';
import { Memory } from '@mastra/memory';
import { LibSQLStore } from '@mastra/libsql';
import { google } from '@ai-sdk/google';

export const translationAgent = new Agent({
  name: 'Translation Assistant',
  instructions: `
You are a translation assistant.
Your task is to correct the input text in its original language
and then translate it into the requested language without rephrasing.
Return only the translated text, without the original text,
as plain text without Markdown.
`,
  memory: new Memory({
    storage: new LibSQLStore({
      url: 'file:../mastra.db',
    }),
  }),
  model: google('gemini-2.5-flash-preview-04-17'),
});