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 with create_react_agent #29403

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

turboslapper
Copy link

Description

This PR replaces all instances of the deprecated initialize_agent function with the newer langgraph.prebuilt.create_react_agent across the LangChain documentation. The updates were made to ensure consistency with the latest library usage and to improve the user experience.

Issue

Closes #29277

Dependencies

None.

Twitter handle

I don't use twitter, but I'm active on GitHub!

Additional Notes

  • All changes were made in the docs/ directory, including .mdx and .ipynb files.
  • Code snippets were updated, imports replaced, and corresponding descriptions adjusted for clarity.
  • Linting and formatting have been applied to the modified files.

Checklist

  • Ran make format and make lint.
  • Verified changes by building and previewing the documentation locally.
  • No new dependencies added.
  • Changes are backwards compatible.

…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
Copy link

vercel bot commented Jan 24, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchain ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 24, 2025 6:17am

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. 🤖:docs Changes to documentation and examples, like .md, .rst, .ipynb files. Changes to the docs/ folder labels Jan 24, 2025
@turboslapper
Copy link
Author

I want to highlight a potential issue with the command poetry install --with lint,docs --no-root, as it returned the following error for me: Group(s) not found: docs (via --with).

Upon further investigation, I noticed that the pyproject.toml file did not include any references to a docs group for Poetry. This appears to contradict the initial instructions provided in this link: LangChain Documentation Setup Guide.

To ensure this wasn't an error on my end, I confirmed I was in the monorepo and even tried running the command on a fresh clone of LangChain without making any changes, but the issue persisted.

@turboslapper
Copy link
Author

Hi @efriis!

I've completed updating all references to initialize_agent with create_react_agent in the documentation as per #29277. All affected examples in the docs/ directory have been updated, and I resolved any formatting/linting issues as well.

Let me know if there's anything else you'd like me to adjust or improve!

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 size:L This PR changes 100-499 lines, ignoring generated files.
Projects
Status: Triage
Development

Successfully merging this pull request may close these issues.

docs: Replace initialize_agent use with langgraph.prebuilt.create_react_agent
1 participant