> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agno.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Translation Agent

> Transcribe, translate, and regenerate audio with GroqTools.

<Warning>
  This v2.7.2 source cannot run as written. It references an input file that is not provided, uses Groq's retired `playai-tts` default, asks for music even though the tool generates speech, and saves WAV bytes with an `.mp3` extension. Provide a real input file, select a current TTS model and voice, change the prompt to request speech, and save the output as `.wav`. See [Groq model deprecations](https://console.groq.com/docs/deprecations) and [Groq text to speech](https://console.groq.com/docs/text-to-speech/).
</Warning>

## Code

```python translation_agent.py theme={null}
import base64
from pathlib import Path

from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.models.groq import GroqTools
from agno.utils.media import save_base64_data

path = "tmp/sample-fr.mp3"

agent = Agent(
    name="Groq Translation Agent",
    model=OpenAIChat(id="gpt-5.2"),
    tools=[GroqTools()],
    cache_session=True,
)

response = agent.run(
    f"Let's transcribe the audio file located at '{path}' and translate it to English. After that generate a new music audio file using the translated text."
)

if response and response.audio:
    base64_audio = base64.b64encode(response.audio[0].content).decode("utf-8")
    save_base64_data(base64_audio, Path("tmp/sample-en.mp3"))  # type: ignore
```

## Prepare a corrected copy

The source fence is preserved for v2.7.2 fidelity. These packages and API keys cover its imports. Apply every change in the warning above before running it.

<Steps>
  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U agno groq openai
    ```
  </Step>

  <Step title="Set API keys">
    <CodeGroup>
      ```bash macOS / Linux theme={null}
      export GROQ_API_KEY="your_groq_api_key_here"
      export OPENAI_API_KEY="your_openai_api_key_here"
      ```

      ```powershell Windows theme={null}
      $Env:GROQ_API_KEY="your_groq_api_key_here"
      $Env:OPENAI_API_KEY="your_openai_api_key_here"
      ```
    </CodeGroup>
  </Step>
</Steps>
