Proposal for 'ConverseUntilAnswered' Agent
Labels: name: area: agent, name: auto:enhancement

### Feature request


**Issue Description:**

I would like to propose the addition of a new Agent called something like 'ConverseUntilAnswered.' This new agent would engage in multi-step interactions with users to obtain an answer according to a required schema, and self-terminate when an answer is obtained.


**Example Use Case:**

Let's consider a scenario where a chatbot needs to collect user satisfaction ratings for its website. The 'ConverseUntilAnswered' agent could be used to facilitate this interaction. Perhaps this is achieved by the LangChain class injecting System messages to ChatGPT at specific times. Consider in the following dialogue that all System messages are injected by the LangChain class.

1. **System Message:** Your task is to ask the user how satisfied they are with this website on a scale from 1 to 10, where 10 is the highest. You are limited to a maximum of 2 interactions with the user. If you are reasonably certain of the user’s score, you are permitted to guess their answer. If you are unable to determine a numerical score, give a rating of “NA”. When you are ready to give a score, reply in the following format: ```ANSWER:<integer score>``` for example, for an answer of 5, you would reply ```ANSWER:5``` and add nothing else to your response. 

2. **Chatbot:** On a scale from 1 to 10, how satisfied are you with this website?

3. **User:** Oh, it’s OK.

4. **Chatbot:** It sounds like you are moderately satisfied. Would you say your satisfaction is a 5 out of 10?

5. **User:** Maybe, it depends on the day.

6. **System Message:** You have used 2 of your 3 available interactions with the user. Please no longer interact with the user, but simply state your final response with the format previously specified.

8. **Chatbot:** ```ANSWER:NA```

By introducing a 'ConverseUntilAnswered' agent, we make it possible to develop an application that conducts a lengthy interview over a series of questions as defined by the programmer. For example:

1. Ask the customer their satisfaction with the website (1-10 scale)
2. Ask whether the customer is likely to recommend this website to their friends (Why or Why not)
3. Ask what feature they would like to see added to this website.


### Motivation

**Justification:**

There is a need for specialized functionality for chatbots that can conduct multi-step conversations and self-terminate once a satisfactory response is obtained. Currently the only way I know to do this is to equip an Agent with a tool that it calls when a task has been completed, but there is no guarantee the agent will ever call that tool, leaving the chatbot open to a lengthy never-ending conversation with the user. By introducing a specialized 'ConverseUntilAnswered' agent, we can minimize calls to the LLM API and ensure closure of a line of inquery to the user.


### Your contribution

I have only once before contributed to an OpenSource project, and this would be my first contribution to the LangChain project. I humbly ask for the community's guidance regarding possible best approaches for implementation using existing LangChain features, and what else should be considered before making a Pull Request.