Idea: Safety scanning middleware for messages.create() #931
MaxwellCalkin
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
As Claude becomes more agentic (MCP tools, code generation, autonomous workflows), TypeScript/JavaScript applications need safety scanning at the API boundary. Common requirements:
Proposal
A middleware/hook pattern in the SDK:
This pattern is standard in JS (Express middleware, fetch interceptors) and would enable composable, drop-in safety scanning.
Existing Implementation
I built @sentinel-ai/sdk — a standalone TypeScript safety scanning library (zero dependencies) that does prompt injection detection, PII redaction, harmful content filtering, toxicity detection, tool-use safety, and obfuscation detection in <2ms.
The Python SDK counterpart (Sentinel AI) implements this as
guarded_message()/guarded_stream()wrappers and an LLM API firewall proxy.But a first-party middleware API would be cleaner than third-party wrappers.
(Cross-posted from anthropic-sdk-python#1227)
Beta Was this translation helpful? Give feedback.
All reactions