Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Replace initialize_agent use with langgraph.prebuilt.create_react_agent #29277

Open
1 task done
efriis opened this issue Jan 17, 2025 · 3 comments · May be fixed by #29403
Open
1 task done

docs: Replace initialize_agent use with langgraph.prebuilt.create_react_agent #29277

efriis opened this issue Jan 17, 2025 · 3 comments · May be fixed by #29403
Labels
🤖:docs Changes to documentation and examples, like .md, .rst, .ipynb files. Changes to the docs/ folder documentation Improvements or additions to documentation good first issue Good for newcomers help wanted Good issue for contributors

Comments

@efriis
Copy link
Member

efriis commented Jan 17, 2025

Privileged issue

  • 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 efriis added documentation Improvements or additions to documentation good first issue Good for newcomers help wanted Good issue for contributors labels Jan 17, 2025
@dosubot dosubot bot added the 🤖:docs Changes to documentation and examples, like .md, .rst, .ipynb files. Changes to the docs/ folder label Jan 17, 2025
@aybdee
Copy link

aybdee commented Jan 18, 2025

I want to try working on this

@Thejaswi05
Copy link

@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

turboslapper added a commit to turboslapper/langchain that referenced this issue Jan 22, 2025
…mpatibility

- Updated code to use `create_react_agent` instead of the deprecated `initialize_agent`.
- Removed explicit `AgentType` parameters as they are implicitly supported by `create_react_agent`.
- Replaced `verbose=True` with `debug=True` for detailed logging.

Partially addresses langchain-ai#29277
@turboslapper
Copy link

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 turboslapper linked a pull request Jan 24, 2025 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:docs Changes to documentation and examples, like .md, .rst, .ipynb files. Changes to the docs/ folder documentation Improvements or additions to documentation good first issue Good for newcomers help wanted Good issue for contributors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants