-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(agents): migrate createReactAgent to core LangChain project #8789
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
2d24127
to
ef9b22d
Compare
ef9b22d
to
7e12e39
Compare
7d91e86
to
27432aa
Compare
Blocked on #8793 |
hntrl
approved these changes
Aug 27, 2025
98250ec
to
1c42611
Compare
linter more fixes fix formatting feat(agents): migrate createReactAgent to core LangChain project update pnpm-lock migrate code ported all code add tests type massage remove coverage dir add readme minor tweaks add integration tests don't generate import maps if not exported as named import more PR updates lint fixes migrate: use Send for each of the tool calls migrate: Allow partially applying tool calls via postModelHook more tests fix linter update vitest config docs(agents): create extensive docs for various createReactAgent features update examples fix environment tests update custom system prompt example update example for control over message generation rename to message preparation add preModelHook for better destinction with controlOverMessagePreparation update accessExternalContext example update accessExternalContextInTools update accessLongTermMemory update example for accessLongTermMemoryInTools update accessThreadLevelState example update accessThreadLevelStateInTools example update postModelHook example update updateThreadLevel example update updateToolsBeforeModelCall example use InMemoryStore in updateLongTermMemoryInTools only export what's important for the examples demonstrate model choice by context proper expose LangGraphRunnableConfig enable human-in-the-loop feat(createReactAgent): `createReactAgent` v1 development (#8667)
6387c21
to
c3af124
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch migrates the
createReactAgent
from LangGraphJS to LangChain canonical. Here is a list of changes that users can expect from this updated agent:💥 Breaking Changes
createReactAgent
doesn't support pre-bound models anymore as it is required to bind tools itselfcreateReactAgent
function.ToolNode
doesn't send anPlease fix your mistakes.
message anymore, instead it will just throwdirectly if the user doesn't handle the error via
handleToolError
🚀 New Features
ToolNode
now also takes a callback as argument to catch errors and send custom tool call responses back to the model, e.g.:While before the agent would make an additional call to the model to parse the output, now it will just
return the raw output from the tool call or model directly.
responseFormat
option to create structured outputs.nativeOutput
function:with multiple tool calls or invalid parsing by providing a
handleError
function.createReactAgent
API ReferenceThe
createReactAgent
function is the main entry point for creating a React agent. It takes in a set of parameters and returns an agent instance. All related types are exported from thelangchain
package.createReactAgent
: the main function to create a React agent.toolOutput
: a function to create a tool output.nativeOutput
: a function to create a native output.AgentState
: the state of the agent.AgentRuntime
: the runtime of the agent.CreateAgentToolConfig
: the runnable config when accessing runtime information within tools.