langchain icon indicating copy to clipboard operation
langchain copied to clipboard

docs: Replace `initialize_agent` use with langgraph.prebuilt.create_react_agent

Open efriis opened this issue 10 months ago • 4 comments

Privileged issue

  • [x] I am a LangChain maintainer, or was asked directly by a LangChain maintainer to create an issue here.

Issue Content

Currently there's a bunch of tools and other integrations that use initialize_agent in their docs page (search langchain/docs for "initialize_agent")

This function has been deprecated since 0.1 and should be replaced with basic langgraph usage as a demo

Deprecated function: https://python.langchain.com/api_reference/langchain/agents/langchain.agents.initialize.initialize_agent.html

Example page using create_react_agent in an example: https://python.langchain.com/docs/integrations/tools/gmail/#use-within-an-agent

This issue doesn't need to be resolved by a single PR and can be tackled incrementally! Just tag this issue for tracking purposes :)

efriis avatar Jan 17 '25 21:01 efriis

I want to try working on this

aybdee avatar Jan 18 '25 20:01 aybdee

@efriis do you expect the changes in the documentation for the tools and integrations using `initialize_agent' listed at the bottom of the page you shared?

Such as: AINetwork Toolkit

AWS Lambda

Thejaswi05 avatar Jan 21 '25 19:01 Thejaswi05

Hi everyone,

I’ve partially updated the documentation to replace deprecated references to initialize_agent with langgraph.prebuilt.create_react_agent. Specifically:

  • I addressed the instances for page 1 of 3 in the search:
    repo:langchain-ai/langchain path:/^docs\// initialize_agent.
  • I plan to work on pages 2 and 3 shortly to complete the updates.

Additionally, I noticed a recurring pattern in examples, such as:

agent.run("what is google's stock")

This doesn't inherently print the output of the agent.run command, and I considered adding something like:

response = agent.run("what is google's stock")
print(response)

to improve clarity for users. However, as this is my first commit, I didn’t want to overstep the scope without further guidance. Let me know if you’d like me to include such improvements!

Looking forward to completing the remaining pages soon.

turboslapper avatar Jan 22 '25 08:01 turboslapper

If no one is working on this issue , can I work on this ?

AffanShaikhsurab avatar Feb 22 '25 02:02 AffanShaikhsurab

I noticed that some parts of the documentation still reference initialize_agent.
Would it be alright if I take over and help with the remaining updates?

Yeonseolee avatar Mar 18 '25 19:03 Yeonseolee

Hi! I’d like to update the EdenAI example in edenai_tools.ipynb to remove initialize_agent and use the recommended approach. Tagging this as part of #29277 and will send a PR shortly.

rthummaluru avatar Apr 18 '25 15:04 rthummaluru

Hi all, please make sure that the code you update in the docs runs without error. Thank you!

ccurme avatar Apr 23 '25 18:04 ccurme

Hi, I'd like to contribute to this issue as well. As I understand it, there are still quite a few tools that still use the deprecated initialize_agent. Should I just pick one page out to edit the docs that is not modified with existing PRs?

colichar avatar Apr 24 '25 18:04 colichar

Hi! I'd like to work on this issue. Please let me know if it's still available.

tskrrish avatar Apr 30 '25 20:04 tskrrish

Hi! I'd like to work on replacing initialize_agent with create_react_agent in the remaining documentation files. I will update the examples to reflect the new recommended usage. Let me know if that's good to proceed!

Vahed-SK avatar May 07 '25 02:05 Vahed-SK

Hi @efriis @Thejaswi05 @ccurme @Yeonseolee ! Would love to work on this issue, no idea where to start from! Is there anyone who I can work with or shadow? Thank you!

HummdG avatar May 15 '25 16:05 HummdG

I've just submitted a commit for NASA ToolKit docs. This is my first experience on GitHub, and I’m still a beginner, so please let me know if there’s anything to adjust! @efriis

Abdelrahman-Nashaat avatar May 24 '25 19:05 Abdelrahman-Nashaat

Hi @efriis and team!

I've begun to replace some instances of initialize_agent with langgraph.prebuilt.create_react_agent in the remaining documentation files.

I've also already started working on some untouched pages from the langchain/docs directory and will ensure the examples run without errors. I’ll tag this issue in my upcoming PR(s) for tracking.

Image

Please let me know if there’s anything specific I should focus on or avoid, as these are the files I will be editing!

Thanks!

tk1475 avatar May 26 '25 13:05 tk1475

Yes ,the first document (NASA) i already PR it and waiting them to reply. Thank you 😊

في الاثنين، ٢٦ مايو ٢٠٢٥، ٥:٢٧ م Ahmed Hassan @.***> كتب:

tk1475 left a comment (langchain-ai/langchain#29277) https://github.com/langchain-ai/langchain/issues/29277#issuecomment-2909928888

Hi @efriis https://github.com/efriis and team!

I've begun to replace some instances of initialize_agent with langgraph.prebuilt.create_react_agent in the remaining documentation files.

I've also already started working on some untouched pages from the langchain/docs directory and will ensure the examples run without errors. I’ll tag this issue in my upcoming PR(s) for tracking.

Screenshot.2025-05-26.185159.png (view on web) https://github.com/user-attachments/assets/bbb8ffb2-f1e1-4dab-b977-8d76d25f69f9

Please let me know if there’s anything specific I should focus on or avoid, as these are the files I will be editing!

Thanks!

— Reply to this email directly, view it on GitHub https://github.com/langchain-ai/langchain/issues/29277#issuecomment-2909928888, or unsubscribe https://github.com/notifications/unsubscribe-auth/BLI5F22J3AXH33YZEFMK5SD3AMQEHAVCNFSM6AAAAABVMYI7C6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDSMBZHEZDQOBYHA . You are receiving this because you commented.Message ID: @.***>

Abdelrahman-Nashaat avatar May 26 '25 14:05 Abdelrahman-Nashaat

Hi team, I would love to work on this issue! @HummdG let me know if you want to work on some of the changes to the docs together.

dohrisalim avatar May 26 '25 15:05 dohrisalim