langchain-ai / langchain

🦜🔗 Build context-aware reasoning applications
https://python.langchain.com
MIT License
95.23k stars 15.45k forks source link

Prevent Infinite Tool Call Loop in Customer Support Agent (LangGraph) #26019

Open AtmehEsraa opened 2 months ago

AtmehEsraa commented 2 months ago

Checked other resources

Example Code

customer_support_llama3.zip

Error Message and Stack Trace (if applicable)

No response

Description

The customer support agent implemented using LangGraph encounters an issue where it enters an infinite loop when calling tools for information retrieval, such as flight status. The agent repeatedly calls the same tool without processing the output or providing a response to the user. This issue needs to be resolved to improve the efficiency and usability of the agent.

System Info

install langchain-core==0.2.9 langchain-community==0.2.5 langchain-experimental==0.0.61 \ langgraph==0.0.69

FraRici90 commented 2 months ago

I have the same issue. Even the most basic tools, sometimes loops.

Mustafa0503 commented 1 month ago

Hello! We're a group of students from the University of Toronto Scarborough, and we're looking to contribute to LangChain. We'd love the opportunity to investigate this bug further.