A tool call often returns more than the agent needs: a database query might return a customer's full record including a card number, a shell command's output might echo an API key from an environment variable. That raw output usually flows straight back into the model's context, and from there it can end up quoted in a response, logged, or forwarded to another agent.
Write sanitize_tool_output(output, forbidden_patterns) that replaces every occurrence of every string in forbidden_patterns with "[REDACTED]", checking patterns in the order given, and returns the result.
No results yet
Run your code to check it against the examples, or submit to run every test.