Langchain Structured_Chat_Zero_Shot_Description agent use no tools 
Labels: name: area: agent, name: auto:bug

### System Info

Name: langchain
Version: 0.0.308
Macos ventura 13.2.1

### Who can help?

@hwchase17
@agola11

### Information

- [ ] The official example notebooks/scripts
- [X] My own modified scripts

### Related Components

- [ ] LLMs/Chat Models
- [ ] Embedding Models
- [ ] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [ ] Document Loaders
- [ ] Vector Stores / Retrievers
- [ ] Memory
- [X] Agents / Agent Executors
- [ ] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

I have two Custom tools :

CustomJiraTicketWriting which use FewShotChatMessagePromptTemplate and StructuredOutputParser.from_response_schemas in order to produce dictionary output with a compatible & developed JSON representing a Jira ticket.
CustomJiraTicketPOST which accept 4 inputs : ticket / email / url / token in order to POST the ticket on Jira.
Both of these function works great separately, but when I use an Structured_Chat_Zero_Shot_Description agent to create a ReACT decision, it appears that the Agent refuse to use any of the tools.

I wonder if i do something wrong or if the Structured_Chat_Zero_Shot_Description agent is bugged ?


```
import os
import re
import json
import openai
import random
import langchain
import demjson3
import requests
from langchain.chat_models import ChatOpenAI
from requests.auth import HTTPBasicAuth
from openai import ChatCompletion
from typing import Optional, Type, List, Dict, Union
from langchain.llms import OpenAI,GPT4All
from pydantic import BaseModel, Field
from langchain.agents import (AgentType, 
                              initialize_agent, 
                              AgentOutputParser, 
                              LLMSingleActionAgent, 
                              AgentExecutor,
                              load_tools)
from langchain.schema import AgentAction, AgentFinish
from langchain.cache import InMemoryCache
from langchain.prompts.few_shot import FewShotPromptTemplate
from langchain.prompts.few_shot_with_templates import FewShotPromptWithTemplates
from langchain.prompts.few_shot import FewShotPromptTemplate
from langchain.pydantic_v1 import BaseModel, Field, validator
from langchain.chains import LLMChain, SequentialChain, SimpleSequentialChain, TransformChain
from langchain.output_parsers import (OutputFixingParser, 
                                      RetryWithErrorOutputParser, 
                                      PydanticOutputParser,
                                      CombiningOutputParser,
                                      ResponseSchema, 
                                      StructuredOutputParser)
from langchain.chains.conversation.memory import ConversationBufferWindowMemory
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler

from langchain.tools import BaseTool, StructuredTool, Tool, tool

from langchain.prompts import (ChatPromptTemplate,
                               PromptTemplate,
                               SystemMessagePromptTemplate,
                               AIMessagePromptTemplate,
                               HumanMessagePromptTemplate,
                               FewShotChatMessagePromptTemplate,
                               StringPromptTemplate,
)
                                      
from langchain.schema import (AIMessage,
                              HumanMessage,
                              SystemMessage
)


from langchain.callbacks.manager import (
    AsyncCallbackManagerForToolRun,
    CallbackManagerForToolRun,
)


email = 'XXXXXXXXXX.jl@gmail.com'
url = "https://XXXXXXXXXX.atlassian.net/rest/api/3/issue"
debug_mode = True
langchain.debug = True
langchain.llm_cache = InMemoryCache()

os.environ["JIRA_API_TOKEN"]= 'XXXXXXXXXX'
api_token_jira = os.environ["JIRA_API_TOKEN"]
os.environ["JIRA_USERNAME"]= 'XXXXXXXXXX'
os.environ["JIRA_INSTANCE_URL"] = "XXXXXXXXXX"
site_jira = os.environ["JIRA_INSTANCE_URL"]
os.environ['OPENAI_API_KEY']='XXXXXXXXXX'
openai_api_key = os.getenv('OPENAI_API_KEY')
api_key = os.getenv('OPENAI_API_KEY')

model_name = 'gpt-3.5-turbo'
temperature = 0.0


model_llm = OpenAI(model_name=model_name, 
                   temperature=temperature, 
                   max_tokens=3500)

model_chat = ChatOpenAI(
    temperature=temperature, 
    max_tokens=3100,
    model_name=model_name)


turbo_llm = ChatOpenAI(
    temperature=temperature,
    model_name=model_name,
    max_tokens=3100,)

class CustomJiraTicketWriting(BaseTool):
    name = "Jira_Ticket_Write"
    description = ("""
        Useful to transform a summary into a real JSON Jira ticket.
        The input should be like :
        {{
            Action: Ticket_writing,
            Action Input: 
                "summary": <ticket summary>, 
        }}
        """)


    def _run(self, 
            summary: str,
            run_manager: Optional[AsyncCallbackManagerForToolRun] = None,
             ) -> dict:
        
        response_schema = ResponseSchema(
            name="jira_ticket",
            description="Jira ticket information",
            structure={
                "fields": {
                    "project": {
                        "key": str
                    },
                    "summary": str,
                    "issuetype": {
                        "name": str
                    },
                    "priority": {
                        "name": str
                    },
                    "description": {
                        "type": str,
                        "version": int,
                        "content": [
                        {
                            "type": str,
                            "content": [
                                {
                                    "type": str,
                                    "text": str
                                }
                            ]
                        },
                        {
                            "type": str,
                            "attrs": {
                                "level": int
                            },
                            "content": [
                                {
                                    "type": str,
                                    "text": str
                                }
                            ]
                        }
                        ]
                    }
                }
            }
        )

        response_schemas=[response_schema]
        output_parser = StructuredOutputParser.from_response_schemas(response_schemas)
        format_instructions = output_parser.get_format_instructions()     
        


        examples = [
          {
            "Jira_Ticket_Summary" : "Creation of the MySQL database",
            "output": """{"fields":{"project":{"key":"AJ"},"summary":"Create a Jira ticket to integrate my MySQL database into our current assets","issuetype":{"name":"Story"},"priority":{"name":"High"},"description":{"type":"doc","version":1,"content":[{"type":"paragraph","content":[{"type":"text","text":"As a developer, I want to integrate my MySQL database with our current assets to improve data management."}]},{"type":"heading","attrs":{"level":2},"content":[{"type":"text","text":"Acceptance Criteria:"}]},{"type":"paragraph","content":[{"type":"text","text":"- The MySQL database is successfully integrated with the application."}]},{"type":"paragraph","content":[{"type":"text","text":"- Data can be efficiently stored and retrieved from the integrated MySQL database."}]},{"type":"paragraph","content":[{"type":"text","text":"- The integration process follows best practices and security standards."}]},{"type":"paragraph","content":[{"type":"text","text":"- The integration is documented for future reference."}]},{"type":"heading","attrs":{"level":2},"content":[{"type":"text","text":"Subtasks:"}]},{"type":"paragraph","content":[{"type":"text","text":"- Analyze the structure of the MySQL database."}]},{"type":"paragraph","content":[{"type":"text","text":"- Create integration scripts for data migration."}]},{"type":"paragraph","content":[{"type":"text","text":"- Implement data synchronization with the application."}]},{"type":"paragraph","content":[{"type":"text","text":"- Perform testing and quality assurance of the integration."}]},{"type":"paragraph","content":[{"type":"text","text":"- Document the integration process and configurations."}]}]}}"""
          }]

        example_prompt = ChatPromptTemplate.from_messages(
            [
          ("human", "{Jira_Ticket_Summary}"),
            ("ai", "{output}")]
        )


        few_shot_prompt = FewShotChatMessagePromptTemplate(
            example_prompt=example_prompt,
            examples=examples,
        )  


        prompt_string = """
        Jira_Ticket_Summary: {Jira_Ticket_Summary}

        {format_instructions}
        """

        prompt = ChatPromptTemplate.from_messages(
            [
                ("system", "You are a Jira assistant specialized in creating technical tickets. You always develop the tickets with precise examples of sub-tasks and acceptance criteria. Remember to use double quotes for keys."),
                few_shot_prompt,
                ("human", prompt_string),
            ]
        )

        final_prompt = ChatPromptTemplate(
            messages=[
               prompt  
            ],
            input_variables=['Jira_Ticket_Summary'],
            partial_variables={"format_instructions": format_instructions},
            output_parser=output_parser
        )


        chain = LLMChain(llm=turbo_llm, 
                         prompt=final_prompt,
                         output_parser=output_parser,
                         output_key="ticket")

        sequential_chain = SequentialChain(chains=[chain],
                                           input_variables=['Jira_Ticket_Summary'],
                                           output_variables=['ticket'],
                                           verbose=True)

        input_data={'Jira_Ticket_Summary' : f'{summary}'}

        result = sequential_chain(input_data)

        print("\n\n\n result_writing : ",result)
        print("\n\n\n result_writing_type : ",type(result),'\n\n\n')
        return result
        
    def _arun(self, 
            summary:str,
            run_manager: Optional[AsyncCallbackManagerForToolRun] = None,
             ) -> str:
        raise NotImplementedError("This tool does not support async")
        
        

class CustomJiraTicketPOST(BaseTool):

    name = "Jira_Ticket_Post"
    description = ("""\
                Useful to POST a ticket in Jira Software
                The input should be like :
        {{
            Action: Jira_Post,
            Action Input: 
                "ticket": <JSON-string of the ticket>,
                "email": <email associated with the Jira Software account>,
                "url": <url to POST the ticket at>,
                "token": <identification JIRA API token>
        }}
        """)

    def _run(
        self,
        ticket: str, 
        email: str,
        url: str,
        token: str,
        run_manager: Optional[AsyncCallbackManagerForToolRun] = None
    ) -> str:

        # Retrieve the values using lowercase keys
        url = url
        email = email
        body = ticket

        auth = HTTPBasicAuth(email, api_token_jira)

        headers = {
          "Accept": "application/json",
          "Content-Type": "application/json"
        }

        response = requests.request(
           "POST",
           url,
           data=body,
           headers=headers,
           auth=auth
        )
        
        return json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": "))
    
    async def _arun(
        self,
        ticket: str, 
        email: str,
        url: str,
        token: str,
        run_manager: Optional[AsyncCallbackManagerForToolRun] = None,
    ) -> str:
        """Use the tool asynchronously."""
        raise NotImplementedError("custom_search does not support async")


PREFIX = """You are a Jira Assistant.
You're designed to assist the user with a wide range of tasks related to Jira object management. 
It goes from understand the user's need for its tickets, writing technical and detailed Jira tickets with descriptions, subtasks and acceptance criteria’s to realize API call (POST, PUT or GET) with Jira objects.
"""


FORMAT_INSTRUCTIONS = """\
\
To complete the request, think step by step about what you do.

Requirements :\
\
Use a json blob to specify a tool by providing an action key (tool name) and an action_input key (tool input).
Provide only ONE action per $JSON_BLOB, as shown:
        
"""
{"action": "{TOOL_NAME}",
"action_input": "{INPUT}"}
"""

To answer the request, please follow the format:\
\
"""
Question: request to answer
Thought: You should always think about what to do
Action: the action to take, should be one of [{tool_names}] and must be a $JSON_BLOB
Observation: Action result
... (repeat Thought/Action/Observation N times)
Thought: I know what to respond
Action:
"""
{"action": "Final Answer",
"action_input": "Final response to human"}
"""
"""

Remarks :
Before to POST a ticket, you need to write it.
Remember to act as a Jira assistant and to conclude by "Final Answer" when you succeed ALL the tasks.
"""


SUFFIX = """

Begin! Reminder to ALWAYS respond with a valid json blob of a single action. Use tools if necessary. 
Respond directly if appropriate. 
Format is Action:```$JSON_BLOB```then Observation.


Previous conversation history:
{chat_history}

Instructions: {input}
{agent_scratchpad}
"""

memory = ConversationBufferWindowMemory(
    memory_key='chat_history',
    k=3,
    return_messages=True
)

tools = [CustomJiraTicketPOST(),CustomJiraTicketWriting()]
conversational_agent = initialize_agent(
    agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION, 
    tools=tools, 
    llm=turbo_llm,
    verbose=True,
    max_iterations=3,
    early_stopping_method='generate',
    handle_parsing_errors="Check your output and make sure it conforms!",
    memory=memory,
    agent_kwargs={
        'prefix': PREFIX, 
        'format_instructions': FORMAT_INSTRUCTIONS,
        'suffix': SUFFIX,
        "input_variables": [
            "input",
            "agent_scratchpad",
            "chat_history"
        ],
        "verbose": True
    }
)

Context = "Write and POST the ticket with following information : "
    
payload = {
    
    "summary": "I want to connect our backend to a new MySQL database. The project key is AJ",
    "email": f"{email}",
    "url": f"{url}",
    "token": f"{api_token_jira}",
}

answer = conversational_agent.run(f'{Context}' + json.dumps(payload))
```

### Expected behavior

Expected behavior :

Well at least use the Writing tools, and then use the Post tool. There is just an uncertainty regarding the acception of the Output of the first tool for the second tool.
Actual behavior:

```
[...]

}
[llm/end] [1:chain:AgentExecutor > 2:chain:LLMChain > 3:llm:ChatOpenAI] [5.15s] Exiting LLM run with output:
{
  "generations": [
    [
      {
...
[chain/end] [1:chain:AgentExecutor] [5.15s] Exiting Chain run with output:
{
  "output": "Action: Jira_Ticket_Write\nAction Input: \n{\n    \"summary\": \"I want to connect our backend to a new MySQL database. The project key is AJ\"\n}"
}
```