Skip to content

refactor: migrate to langchain v1#21

Merged
vrtornisiello merged 3 commits intostagingfrom
refactor/migrate-langchain-v1
Mar 10, 2026
Merged

refactor: migrate to langchain v1#21
vrtornisiello merged 3 commits intostagingfrom
refactor/migrate-langchain-v1

Conversation

@vrtornisiello
Copy link
Collaborator

@vrtornisiello vrtornisiello commented Mar 10, 2026

Migrate agent creation to LangChain's create_agent function.

The new create_agent function from langchain.agents is the new standard way to build agents in LangChain v1. It provides a simpler interface while offering greater customization potential through middleware.

Key changes:

  • Replace custom ReActAgent with create_agent
  • Replace custom trim_messages_before_agent hook with built-in SummarizationMiddleware
  • Replace custom recursion limit handling with ModelCallLimitMiddleware
  • Update _process_chunk to handle the new node names ("model" instead of "agent", "ModelCallLimitMiddleware.before_model" for limit events)

The new `create_agent` function from `langchain.agents` is the standard way to
build agents in LangChain v1. It provides a simpler interface while offering greater customization potential through middleware.

Key changes:
- Replace custom `ReActAgent` with `create_agent`
- Replace custom `trim_messages_before_agent` hook with built-in `SummarizationMiddleware`
- Replace custom recursion limit handling with `ModelCallLimitMiddleware`
- Update `_process_chunk` to handle the new node names ("model" instead
  of "agent", "ModelCallLimitMiddleware.before_model" for limit events)
@vrtornisiello vrtornisiello merged commit 8bbd106 into staging Mar 10, 2026
1 check passed
@vrtornisiello vrtornisiello deleted the refactor/migrate-langchain-v1 branch March 10, 2026 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant