LangChain
Add brin to LangChain. Guard DynamicStructuredTool callbacks so brin checks every artifact before the tool touches external context.
LangChain tools are regular functions behind a tool interface. that means you can make brin part of the tool path itself: check the artifact first, then run the external action only when the verdict allows it.
##how it works
put a shared brin helper in front of any DynamicStructuredTool or tool() callback that reaches outside your system. that keeps the enforcement deterministic even if the model ignores natural-language guidance.
##setup
1. Add a shared helper:
2. Guard external tools before they run:
##extending the pattern
apply the same helper to every tool that handles untrusted context:
- package install tools:
npm/<package>,pypi/<package>,crate/<package> - repo readers and cloners:
repo/<owner>/<repo> - browsing or scraping tools:
domain/<domain>orpage/<domain/path> - MCP and skill loaders:
mcp/<owner>/<repo>andskill/<owner>/<repo>
if you use LangChain's tool() helper instead of DynamicStructuredTool, same pattern: call brin first inside the tool function, then execute the side effect.
On this page