langchain
langchain copied to clipboard
docs: Replace `initialize_agent` use with langgraph.prebuilt.create_react_agent
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 :)
I want to try working on this
@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
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.
If no one is working on this issue , can I work on this ?
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?
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.
Hi all, please make sure that the code you update in the docs runs without error. Thank you!
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?
Hi! I'd like to work on this issue. Please let me know if it's still available.
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!
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!
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
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.
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!
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: @.***>
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.