From b4cb2089a293de68d418fc886eea27a5250e7dac Mon Sep 17 00:00:00 2001 From: William FH <13333726+hinthornw@users.noreply.github.com> Date: Thu, 31 Oct 2024 15:29:34 -0700 Subject: [PATCH] langchain[patch]: Add warning in react agent (#26980) --- libs/core/langchain_core/callbacks/manager.py | 3 ++- libs/langchain/langchain/agents/react/agent.py | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/libs/core/langchain_core/callbacks/manager.py b/libs/core/langchain_core/callbacks/manager.py index 58340be1ed9a0..9a25734f9371f 100644 --- a/libs/core/langchain_core/callbacks/manager.py +++ b/libs/core/langchain_core/callbacks/manager.py @@ -2502,7 +2502,8 @@ async def foo(inputs): ): print(event) - .. warning: If using python <= 3.10 and async, you MUST + .. warning:: + If using python <= 3.10 and async, you MUST specify the `config` parameter or the function will raise an error. This is due to a limitation in asyncio for python <= 3.10 that prevents LangChain from automatically propagating the config object on the user's diff --git a/libs/langchain/langchain/agents/react/agent.py b/libs/langchain/langchain/agents/react/agent.py index faf86789ce117..137263a5db973 100644 --- a/libs/langchain/langchain/agents/react/agent.py +++ b/libs/langchain/langchain/agents/react/agent.py @@ -27,6 +27,12 @@ def create_react_agent( Based on paper "ReAct: Synergizing Reasoning and Acting in Language Models" (https://arxiv.org/abs/2210.03629) + .. warning:: + This implementation is based on the foundational ReAct paper but is older and not well-suited for production applications. + For a more robust and feature-rich implementation, we recommend using the `create_react_agent` function from the LangGraph library. + See the [reference doc](https://langchain-ai.github.io/langgraph/reference/prebuilt/#langgraph.prebuilt.chat_agent_executor.create_react_agent) + for more information. + Args: llm: LLM to use as the agent. tools: Tools this agent has access to.