Skip to content

Conversation

@nfcampos
Copy link
Collaborator

  • 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

@nfcampos nfcampos requested review from ccurme and mdrxy as code owners October 16, 2025 16:06
@github-actions github-actions bot added integration Related to a provider partner package integration langchain Related to the package `langchain` v1 Issue specific to LangChain 1.0 labels Oct 16, 2025
@nfcampos nfcampos changed the title Add ShellToolMiddleware and ClaudeBashToolMiddleware feat(langchain_v1): Add ShellToolMiddleware and ClaudeBashToolMiddleware Oct 16, 2025
@@ -0,0 +1,350 @@
"""Shared redaction utilities for middleware components."""
Copy link
Collaborator Author

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

codspeed-hq bot commented Oct 16, 2025

CodSpeed Performance Report

Merging #33527 will not alter performance

Comparing nc/16oct/bash-middleware (4251de4) with master (34de8ec)1

Summary

✅ 3 untouched
⏩ 31 skipped2

Footnotes

  1. No successful run was found on master (e0e1142) during the generation of this report, so 34de8ec was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 31 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@nfcampos nfcampos force-pushed the nc/16oct/bash-middleware branch from 508ac4f to c89cf87 Compare October 16, 2025 16:17
@nfcampos nfcampos force-pushed the nc/16oct/bash-middleware branch from c89cf87 to 0a8224b Compare October 16, 2025 16:20
@eyurtsev eyurtsev self-assigned this Oct 17, 2025
eyurtsev added a commit that referenced this pull request Oct 17, 2025
@eyurtsev eyurtsev closed this Oct 17, 2025
@eyurtsev eyurtsev reopened this Oct 17, 2025
@sydney-runkle
Copy link
Collaborator

let's merge tonight 😈

@eyurtsev eyurtsev merged commit a022e3c into master Oct 17, 2025
47 checks passed
@eyurtsev eyurtsev deleted the nc/16oct/bash-middleware branch October 17, 2025 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature integration Related to a provider partner package integration 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.

3 participants