Home / Function/ _apply_redactions() — langchain Function Reference

_apply_redactions() — langchain Function Reference

Architecture documentation for the _apply_redactions() function in shell_tool.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  5160a5db_aeea_2d69_de2b_e5d653052a9d["_apply_redactions()"]
  4e57a0ff_f1a5_e2e9_6949_569d7cd6d70a["ShellToolMiddleware"]
  5160a5db_aeea_2d69_de2b_e5d653052a9d -->|defined in| 4e57a0ff_f1a5_e2e9_6949_569d7cd6d70a
  8b644660_40e4_465a_3e51_e1a3166de4f9["_run_shell_tool()"]
  8b644660_40e4_465a_3e51_e1a3166de4f9 -->|calls| 5160a5db_aeea_2d69_de2b_e5d653052a9d
  style 5160a5db_aeea_2d69_de2b_e5d653052a9d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/langchain/agents/middleware/shell_tool.py lines 751–759

    def _apply_redactions(self, content: str) -> tuple[str, dict[str, list[PIIMatch]]]:
        """Apply configured redaction rules to command output."""
        matches_by_type: dict[str, list[PIIMatch]] = {}
        updated = content
        for rule in self._redaction_rules:
            updated, matches = rule.apply(updated)
            if matches:
                matches_by_type.setdefault(rule.pii_type, []).extend(matches)
        return updated, matches_by_type

Domain

Subdomains

Called By

Frequently Asked Questions

What does _apply_redactions() do?
_apply_redactions() is a function in the langchain codebase, defined in libs/langchain_v1/langchain/agents/middleware/shell_tool.py.
Where is _apply_redactions() defined?
_apply_redactions() is defined in libs/langchain_v1/langchain/agents/middleware/shell_tool.py at line 751.
What calls _apply_redactions()?
_apply_redactions() is called by 1 function(s): _run_shell_tool.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free