How lukelittle/rawsug-pii-demo works
Decide in Code is an AWS support-message guard: an IAM-signed client submits a message, the Lambda runs a probability-based System One circuit, and deterministic code either redacts and routes the message or sends it for human review. The review path adds a best-effort Bedrock summary and queues the message in SQS. CloudWatch records decision traces without message text. Source excerpts establish the Lambda’s internal calls and integrations; the README documents API Gateway, logging, and the hosted services.
Main entry points: handler.py Request handler · backend.py Model backend · review.py Review enqueue · decide.py Decision rules
Components 14
Request ingress
- API Gateway
- Request handler
lambda/handler.py
Decision circuit
- Probability circuit
lambda/circuit.py - Model backend
lambda/backend.py - Decision rules
lambda/decide.py - Deterministic masking
lambda/redact.py
Human review
- Review enqueue
lambda/review.py
AWS services
- Amazon Bedrock
- Human-review queue
- CloudWatch Logs
- Secrets Manager
Other components
- Signed client
- System One model
- SageMaker endpoint
Connections 13
- Signed client → API Gateway: sends signed request
README.md - API Gateway → Request handler: routes POST
README.md - Request handler → Probability circuit: runs circuit
lambda/handler.py - Request handler → Model backend: creates backend
lambda/handler.py - Model backend → System One model: requests answers
README.md - Model backend → SageMaker endpoint: invokes endpoint
- Model backend → Secrets Manager: reads API key
lambda/backend.py - Request handler → Decision rules: evaluates gates
lambda/handler.py - Decision rules → Deterministic masking: masks message
lambda/decide.py - Request handler → Review enqueue: enqueues review
lambda/handler.py - Review enqueue → Amazon Bedrock: summarizes message
lambda/review.py - Review enqueue → Human-review queue: sends review
lambda/review.py - Request handler → CloudWatch Logs: writes traces
README.md