Language support for Agents
Labels: name: area: agent, name: auto:enhancement

### Feature request

Agents can deal with prompts in different languages, but they might get confused or more unreliable if the internal prompts (e.g. format structure with the action, action input, thought etc.) are still in English.

That's why I thought about an additional language option when initializing an agent. I tried to come up with an idea of how to implement this efficiently, but I found it particularly hard to implement it, so it can be used for every language. 

My initial thought was to specify the necessary prompts in a different language and initialize the agent with an extra keyword. With this approach only a finite number of languages can be covered and it could end up in a mess to save all the prompts in different languages.

My second thought was to initialize the agent with a language keyword and then translate all the prompts in the desired language. That could be too much of a hustle for just initializing an agent with prompts that are actually known.

I wanted to share this and see if this is actually something that could be useful, and maybe gather some ideas of how to implement it.

### Motivation

I've implemented an MRKL agent that writes a detailed article on a specified topic based on internet search. In my specific case, it should write an article about topics related to Germany, e.g. the drought situation in Germany. Naively, my first attempt was to give it a prompt like _Write a detailed article about the drought situation in Germany. The article must be written in German language_.

I discovered two problems:

1. As I was giving the prompt in English, the model "thought" in English as well. Therefore, the action inputs were in English, too. This led to the result that all search results were also in English and primarily from sources (e.g. The Guardian, BBC) outside of Germany reporting about the drought situation in Germany. What I would have liked instead are search results from German newspapers or similar.
2. The text generation was very much inconsistent. It wasn't quite able to write the final article in German, as all information was given in English. Sometimes, it managed to write the text in German, but I also wrote all intermediate steps (action, action input, Observation, Thought, etc.) in German, too. That led to the problem of not finding the tool (tool descriptions were also in English) and resulting OutputParser Error, because the English keywords _thought_ and _action_ etc. could be found.

So my goal was to create an agent that solely worked in the German language. Meaning, that the prompt, intermediate steps, search results and the final output are all in German.

So what I did was reimplementing all the necessary MRKL agent functions and templates in a German version. It worked out and the results were as expected and reliable.

I think that agents with different language support could be beneficial for more users. You can give it a prompt in other languages but that the agent's internal prompts are in specific language, too.

### Your contribution

I am not really sure how to do that in a good way, so that multiple languages are supported for all the agents, and if that's even desired. But if there is a good strategy, I would like to try to implement it.