Skip to content

Conversation

nhuang-lc
Copy link
Contributor

@nhuang-lc nhuang-lc commented Oct 9, 2025

  • Description: add subagents middleware for deepagents, which creates a task tool which allows the main agent to create subagents
  • Dependencies: add langchain-anthropic as test dependency

TODO

  • Add more test coverage

nfcampos and others added 6 commits October 9, 2025 12:58
…memory, and file

search

Middleware Classes

Text Editor Tools
- StateClaudeTextEditorToolMiddleware: In-memory text editor using agent state
- FilesystemClaudeTextEditorToolMiddleware: Text editor operating on real filesystem

Implementing Claude's text editor tools
https://docs.claude.com/en/docs/agents-and-tools/tool-use/text-editor-tool Operations:
view, create, str_replace, insert

Memory Tools
- StateClaudeMemoryToolMiddleware: Memory persistence in agent state
- FilesystemClaudeMemoryToolMiddleware: Memory persistence on filesystem

Implementing Claude's memory tools
https://docs.claude.com/en/docs/agents-and-tools/tool-use/memory-tool Operations: Same
as text editor plus delete and rename

File Search Tools
- StateFileSearchMiddleware: Search state-based files
- FilesystemFileSearchMiddleware: Search real filesystem

Provides Glob and Grep tools with same schema as used by Claude Code (but compatible
with any model)
- Glob: Pattern matching (e.g., **/*.py, src/**/*.ts), sorted by modification time
- Grep: Regex content search with output modes (files_with_matches, content, count)

Usage

``` from langchain.agents import create_agent from langchain.agents.middleware import (
StateTextEditorToolMiddleware, StateFileSearchMiddleware, )

agent = create_agent( model=model, tools=[], middleware=[
StateTextEditorToolMiddleware(), StateFileSearchMiddleware(), ], ) ```
@github-actions github-actions bot added langchain Related to the package `langchain` dependencies Pull requests that update a dependency file v1 Issue specific to LangChain 1.0 feature labels Oct 9, 2025
Copy link
Collaborator

@eyurtsev eyurtsev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very quick drive by comments --- no need to address right now, i'll take another look in the morning tomorrow

@github-actions github-actions bot added feature and removed feature labels Oct 10, 2025
Copy link
Collaborator

@sydney-runkle sydney-runkle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deepagents are super exciting! Really looking forward to these new middlewares, especially the subagents one.

I have some concern about introducing the create_deep_agent factory here, imo it has a significantly lower ceiling than create_agent because under the hood, we decide on all of the middleware being used. That means we decide on the config, prompts, etc. And it's not easy to plug and play w/ the current API.

When on a call w/ a customer using deepagents recently, they mentioned they really liked the deepagent middleware, but they were going to have to copy all of the deepagents code and then make their own customizations to the middleware stack (ex, different settings for summarization, etc).

I would be more comfortable if we introduced just the middleware for now + really leaned into documenting how to create a "deep agent" (it's really just a few lines of code right, basically the list of middleware + the base agent prompt).

We could have a whole deepagents guide or even conceptual page that talks about all the ways you might want to customize your deep agent :)

def wrap_model_call(
self,
request: ModelRequest,
handler: Callable[[ModelRequest], AIMessage],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note to myself we should have a type alias here, I can work on this over the weekend :)

@sydney-runkle
Copy link
Collaborator

Another note -- I've updated the HITL API as discussed, will want to update this accordingly.

#33397

@nfcampos nfcampos force-pushed the nc/9oct/file-tools-middleware branch 3 times, most recently from 255b316 to 4d48faa Compare October 15, 2025 19:01
@nfcampos nfcampos force-pushed the nc/9oct/file-tools-middleware branch from 4d48faa to 6b6eeae Compare October 15, 2025 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file feature langchain Related to the package `langchain` v1 Issue specific to LangChain 1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants