-
Notifications
You must be signed in to change notification settings - Fork 19.4k
feat(langchain_v1): Add ShellToolMiddleware and ClaudeBashToolMiddleware #33527
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
Conversation
nfcampos
commented
Oct 16, 2025
- Both middleware share the same implementation, the only difference is one uses Claude's server-side tool definition, whereas the other one uses a generic tool definition compatible with all models
- Implemented 3 execution policies (responsible for actually running the shell process)
- HostExecutionPolicy runs the shell as subprocess, appropriate for already sandboxed environments, eg when run inside a dedicated docker container
- CodexSandboxExecutionPolicy runs the shell using the sandbox command from the Codex CLI which implements sandboxing techniques for Linux and Mac OS.
- DockerExecutionPolicy runs the shell inside a dedicated Docker container for isolation.
- Implements all behaviours described in https://docs.claude.com/en/docs/agents-and-tools/tool-use/bash-tool#handle-large-outputs including timeouts, truncation, output redaction, etc
| @@ -0,0 +1,350 @@ | |||
| """Shared redaction utilities for middleware components.""" | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is moved from PIIMiddleware so the same logic can be used for shell output redaction
CodSpeed Performance ReportMerging #33527 will not alter performanceComparing Summary
Footnotes
|
508ac4f to
c89cf87
Compare
c89cf87 to
0a8224b
Compare
File search middleware from #33527
|
let's merge tonight 😈 |