Add enhanced sensitive tools support with automatic content detection and tracing redaction #38
+964
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implements comprehensive sensitive tools support to prevent sensitive data from appearing in traces while maintaining full agent functionality.
Problem
The issue requested adding support for sensitive tools that should not be traced, referencing the
llm-guardlibrary for sensitive content detection.Solution
This PR adds a complete sensitive tools system with automatic content detection and tracing redaction:
🔍 Automatic Sensitive Content Detection
llm-guardlibrary for advanced PII and secrets detection⚙️ Flexible Configuration System
🛡️ Comprehensive Tracing Redaction
[REDACTED]in all trace events🔧 Implementation Details
Core Components Added:
jaf/core/sensitive.py- Main detection engine withSensitiveContentDetectorclassjaf/core/engine.py- Automatic input/output scanning during tool executionSensitiveContentConfiginRunConfig- Per-run configuration supportCompositeTraceCollectorOptional Dependencies:
llm-guard>=0.3.0available aspip install jaf-py[sensitive]Backwards Compatibility:
ToolSchema.sensitive=Truemarking continues to work📋 Testing & Examples
examples/enhanced_sensitive_tools_demo.pyshowcasing all capabilitiesdocs/sensitive-tools.md🎯 Key Benefits
This implementation fully addresses the issue requirement while significantly enhancing JAF's capabilities for secure, production-ready AI agent deployments.
Related Issue
Closes issue requesting sensitive tools support with reference to llm-guard library integration.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
example.compython examples/sensitive_tools_demo.py(dns block)huggingface.coimport llm_guard
from llm_guard.input_scanners import Secrets
from llm_guard.output_scanners import Sensitive
Check the actual API
print('Secrets scanner signature:')
import inspect
print(inspect.signature(Secrets.init))
print('Secrets scan method signature:')
print(inspect.signature(Secrets().scan))
print()
print('Sensitive scanner signature:')
print(inspect.signature(Sensitive.init))
print('Sensitive scan method signature:')
print(inspect.signature(Sensitive().scan))` (dns block)
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.