Skip to content
This repository was archived by the owner on Nov 2, 2026. It is now read-only.

fix: replace deprecated create_react_agent with langchain create_agent - #41

Closed
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1788167487-langgraph-create-agent
Closed

devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1788167487-langgraph-create-agent

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Both LangGraph examples still build their agents with langgraph.prebuilt.create_react_agent, which emits LangGraphDeprecatedSinceV10: create_react_agent has been moved to langchain.agents ... Deprecated in LangGraph V1.0 to be removed in V2.0 on every run. Both examples already depend on langchain = "^1.0.0", so the replacement is available today.

-from langgraph.prebuilt import create_react_agent
+from langchain.agents import create_agent
-agent = create_react_agent(model=llm, tools=[get_weather], prompt=agent_config.instructions)
+agent = create_agent(llm, tools=[get_weather], system_prompt=agent_config.instructions)
  • Removes the deprecation warning users see the first time they run poetry run agent / poetry run agent-graph.
  • prompt= becomes system_prompt= — the only renamed argument; the returned object is still a compiled graph with the same invoke({"messages": [...]}) / response["messages"] shape, so metric tracking is unchanged.
  • No dependency changes: every manifest uses floor/caret constraints and poetry.lock is gitignored, so poetry install already 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):

cd getting_started/langgraph/react_agent && poetry install && poetry run agent
cd getting_started/langgraph/state_graph && poetry install && poetry run agent-graph

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 the get_weather tool, metrics tracked with Success: True. The LangGraphDeprecatedSinceV10 warning 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 to main (verified by running the pre-change file against the same configs).

Also ran poetry install in all example directories (the repo's only CI check) and imported every example module with DeprecationWarnings enabled.

Not changed

  • getting_started/gemini/generate_content keeps google-genai = "^1.30.0"; latest is 2.x, which is a major jump.
  • The 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.
  • langgraph stays a direct dependency of both examples (state_graph still uses StateGraph/Command; create_agent returns a compiled LangGraph graph).

Known limitations / follow-ups

  • launchdarkly-observability's generated GraphQL client imports the deprecated websockets.client / websockets.legacy APIs, so a DeprecationWarning prints on import of every example. That needs an upstream fix in the observability SDK.
  • In state_graph, the documentation node's report section renders as [] when the config points at an Anthropic model (the last message's content is an empty block list). This reproduces identically on main, so it is pre-existing and provider-specific — the documented OpenAI/Gemini/Bedrock providers could not be exercised here (no provider credentials available).
  • Neither LangGraph example declares 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

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot added the devin-pr PR created by Devin label Aug 31, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

@cursor review

@jeffdupont

Copy link
Copy Markdown
Contributor

Closing this because hello-python-ai is being archived. Its examples use the legacy LaunchDarkly AI SDK for Python (launchdarkly-server-sdk-ai), which is in maintenance mode and no longer receives new features. For current examples, see the Python AI SDK examples. To move existing code, see Migrate from the legacy AI SDKs.

@jeffdupont jeffdupont closed this Nov 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

devin-pr PR created by Devin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant