From ea7720aa1f958b0ef8ce1b39097dbc5eb4e311ca Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Mon, 31 Aug 2026 09:11:27 +0000 Subject: [PATCH] fix: replace deprecated create_react_agent with langchain create_agent Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../langgraph/react_agent/langgraph_agent_example.py | 10 +++++----- .../state_graph/langgraph_multi_agent_example.py | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/getting_started/langgraph/react_agent/langgraph_agent_example.py b/getting_started/langgraph/react_agent/langgraph_agent_example.py index f804f61..6659086 100644 --- a/getting_started/langgraph/react_agent/langgraph_agent_example.py +++ b/getting_started/langgraph/react_agent/langgraph_agent_example.py @@ -8,8 +8,8 @@ from ldai.providers import LDAIMetrics from ldai_langchain import sum_token_usage_from_messages from ldobserve import ObservabilityConfig, ObservabilityPlugin +from langchain.agents import create_agent from langchain.chat_models import init_chat_model -from langgraph.prebuilt import create_react_agent load_dotenv() @@ -87,11 +87,11 @@ def main(): model_provider=langchain_provider, ) - # Create a React agent with the LLM and tools - agent = create_react_agent( - model=llm, + # Create a tool-calling agent with the LLM and tools + agent = create_agent( + llm, tools=[get_weather], - prompt=agent_config.instructions + system_prompt=agent_config.instructions ) SAMPLE_QUESTION = "What is the weather in Tokyo?" diff --git a/getting_started/langgraph/state_graph/langgraph_multi_agent_example.py b/getting_started/langgraph/state_graph/langgraph_multi_agent_example.py index 4243f95..8a1d0fe 100644 --- a/getting_started/langgraph/state_graph/langgraph_multi_agent_example.py +++ b/getting_started/langgraph/state_graph/langgraph_multi_agent_example.py @@ -8,8 +8,8 @@ from ldai.tracker import TokenUsage from ldai_langchain import get_ai_metrics_from_response from ldobserve import ObservabilityConfig, ObservabilityPlugin +from langchain.agents import create_agent from langchain.chat_models import init_chat_model -from langgraph.prebuilt import create_react_agent from langgraph.graph import StateGraph, END from langgraph.types import Command from typing_extensions import TypedDict @@ -97,8 +97,8 @@ def create_agent_with_config(aiclient, config_key, context): model_provider=langchain_provider, ) - # Create a React agent with the LLM - agent = create_react_agent(llm, [], prompt=agent_config.instructions) + # Create a tool-calling agent with the LLM + agent = create_agent(llm, [], system_prompt=agent_config.instructions) return agent, agent_config.create_tracker(), False