Skip to content
langchain4j/langchain4j·Indexed by this site · Originally published· Defenses →

langchain4j plans to add tool guardrails to core, starting with tool output guardrails

Add tool guardrails (starting with tool output guardrails) to core

AI summary

The langchain4j repository filed issue #7065, proposing to add tool guardrails to langchain4j core, starting with tool output guardrails. The proposal notes that tool results such as local tools, MCP tools, fetched web pages and search summaries are currently passed to the model without validation, while input guardrails only look at user messages and output guardrails only look at the final AI reply, leaving a gap for indirect prompt injection. The plan is to port the existing ToolInputGuardrail and ToolOutputGuardrail concepts from quarkus-langchain4j into core, reusing existing Guardrail types and executor mechanisms as much as possible, applying them uniformly on the tool execution path so that local tools and MCP tools behave consistently; maintainers jmartisk and mariofusco have already agreed in prior discussion to include it in core. A technical validation will be done before implementation, and prompt injection checks and test cases similar to PatternBasedPromptInjectionGuardrail will follow once the API lands.

Read originalgithub.com