fix: replace deprecated create_react_agent with langchain create_agent - #41
Draft
devin-ai-integration[bot] wants to merge 1 commit into
Draft
fix: replace deprecated create_react_agent with langchain create_agent#41devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Contributor
Author
|
@cursor review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Both LangGraph examples still build their agents with
langgraph.prebuilt.create_react_agent, which emitsLangGraphDeprecatedSinceV10: create_react_agent has been moved to langchain.agents ... Deprecated in LangGraph V1.0 to be removed in V2.0on every run. Both examples already depend onlangchain = "^1.0.0", so the replacement is available today.poetry run agent/poetry run agent-graph.prompt=becomessystem_prompt=— the only renamed argument; the returned object is still a compiled graph with the sameinvoke({"messages": [...]})/response["messages"]shape, so metric tracking is unchanged.poetry.lockis gitignored, sopoetry installalready resolves to the latest within-major releases of the AI SDK, the LangChain/LangGraph packages, and the observability SDK.No screenshots: these examples are console applications with no UI. No staging preview applies — reviewers can run them locally per the steps below.
Implementation details
How to test
With a LaunchDarkly SDK key and an agent-mode AI Config (plus the provider key for the model the config selects):
Both were run end-to-end against real agent-mode AI Configs before and after the change:
react_agent: answered the sample weather question using theget_weathertool, metrics tracked withSuccess: True. TheLangGraphDeprecatedSinceV10warning is gone after the change.state_graph: the full two-agent code-review workflow ran, both nodes evaluated their configs, and the final report was produced — output equivalent tomain(verified by running the pre-change file against the same configs).Also ran
poetry installin all example directories (the repo's only CI check) and imported every example module withDeprecationWarnings enabled.Not changed
getting_started/gemini/generate_contentkeepsgoogle-genai = "^1.30.0"; latest is 2.x, which is a major jump.launchdarkly-server-sdk-ai = ">=0.20.0"floors are left alone: the constraint already installs the latest 1.x, and the declared minimum still exposes every API these examples use.langgraphstays a direct dependency of both examples (state_graphstill usesStateGraph/Command;create_agentreturns a compiled LangGraph graph).Known limitations / follow-ups
launchdarkly-observability's generated GraphQL client imports the deprecatedwebsockets.client/websockets.legacyAPIs, so aDeprecationWarningprints on import of every example. That needs an upstream fix in the observability SDK.state_graph, the documentation node's report section renders as[]when the config points at an Anthropic model (the last message'scontentis an empty block list). This reproduces identically onmain, so it is pre-existing and provider-specific — the documented OpenAI/Gemini/Bedrock providers could not be exercised here (no provider credentials available).langchain-anthropic, so Anthropic-backed configs fail with an install hint; that matches their.env.example/README, which advertise only OpenAI, Google, and AWS. Anthropic support for the plain LangChain example is handled by chore: add ANTHROPIC_API_KEY to langchain example .env.example #40.Link to Devin session: https://app.devin.ai/sessions/e48229e292c14f86af398aa1b7e9fe66
Open in Devin Desktop: https://app.devin.ai/desktop/session/e48229e292c14f86af398aa1b7e9fe66?variant=devin