KeyError: 'tool_names'
Labels: name: area: agent, name: auto:bug

### System Info

Python 3.11.4
LangChain 0.0.321

Platform info (WSL2):
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.6 LTS"

### Who can help?

_No response_

### Information

- [ ] The official example notebooks/scripts
- [ ] My own modified scripts

### Related Components

- [ ] LLMs/Chat Models
- [ ] Embedding Models
- [X] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [ ] Document Loaders
- [ ] Vector Stores / Retrievers
- [ ] Memory
- [X] Agents / Agent Executors
- [X] Tools / Toolkits
- [X] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

This is the (partial) code snippet that I run: 

```python
from langchain.chat_models import ChatOpenAI

prompt = hub.pull("hwchase17/react-chat-json")

llm = ChatOpenAI(max_retries=10, temperature=0,
				  max_tokens=400, **model_kwargs)

llm_with_stop = llm.bind(stop=["\nObservation"])

from langchain.agents.output_parsers import JSONAgentOutputParser
from langchain.agents.format_scratchpad import format_log_to_messages

# Connecting to Opensearch
docsearch = OpenSearchVectorSearch(index_name=index_uk, embedding_function=embeddings, opensearch_url=opensearch_url, http_auth=('admin', auth))

# We need some extra steering, or the chat model forgets how to respond sometimes
TEMPLATE_TOOL_RESPONSE = """TOOL RESPONSE: 
---------------------
{observation}

USER'S INPUT
--------------------

Okay, so what is the response to my last comment? If using information obtained from the tools you must mention it explicitly without mentioning the tool names - I have forgotten all TOOL RESPONSES! Remember to respond with a markdown code snippet of a json blob with a single action, and NOTHING else - even if you just want to respond to the user. Do NOT respond with anything except a JSON snippet no matter what!"""


from langchain.agents import AgentExecutor
from langchain.agents.agent_toolkits import create_retriever_tool
tool = create_retriever_tool(
	docsearch.as_retriever(), 
	"search_hr_documents",
	"Searches and returns documents regarding HR-related questions."
)
tool
print("tool", tool)

from langchain.agents.openai_functions_agent.base import OpenAIFunctionsAgent
agent = OpenAIFunctionsAgent(llm=llm, tools=[tool], prompt=prompt)

memory = ConversationBufferMemory(memory_key="chat_history", return_messages=True)
agent_executor = AgentExecutor(agent=agent, tools=[tool,tool], verbose=True, memory=memory, return_intermediate_steps=True)

print("full_question ===>", full_question)

result = agent_executor({"input": full_question})
```

When I run it, it logs the below error:

```
tool name='search_hr_documents' description='Searches and returns documents regarding HR-related questions.' func=<bound method BaseRetriever.get_relevant_documents of VectorStoreRetriever(tags=['OpenSearchVectorSearch', 'OpenAIEmbeddings'], vectorstore=<langchain.vectorstores.opensearch_vector_search.OpenSearchVectorSearch object at 0x00000247DC4ABA50>)> coroutine=<bound method BaseRetriever.aget_relevant_documents of VectorStoreRetriever(tags=['OpenSearchVectorSearch', 'OpenAIEmbeddings'], vectorstore=<langchain.vectorstores.opensearch_vector_search.OpenSearchVectorSearch object at 0x00000247DC4ABA50>)>
full_question ===> Am I allowed to get a company car ?


c:\project\transformed_notebook.ipynb Cell 8 line 1
    190 agent_executor = AgentExecutor(agent=agent, tools=[tool,tool], verbose=True, memory=memory, return_intermediate_steps=True)
    192 print("full_question ===>", full_question)
--> 194 result = agent_executor({"input": full_question})
    196 # print("result ===>", result)
    197 
    198 # chain_type_kwargs = {"prompt": prompt,
   (...)
    211 # out = chain(full_question)
    212 # Cleaning the answer

File c:\Users\raaz\AppData\Local\Programs\Python\Python311\Lib\site-packages\langchain\chains\base.py:310, in Chain.__call__(self, inputs, return_only_outputs, callbacks, tags, metadata, run_name, include_run_info)
    308 except BaseException as e:
    309     run_manager.on_chain_error(e)
--> 310     raise e
    311 run_manager.on_chain_end(outputs)
...
     99 }
    100 full_inputs = dict(**selected_inputs, agent_scratchpad=agent_scratchpad)
    101 prompt = self.prompt.format_prompt(**full_inputs)

KeyError: 'tool_names'
```

How come this error is generated even though the `tools` argument is provided and is well-defined ?

### Expected behavior

The error should not be raised since tools are defined the correct way (as per the official LangChain docs)