Add Superagent safety middleware notebook#37
Open
DK09876 wants to merge 1 commit into
Open
Conversation
…gent-safety) Pairs with the hindsight-superagent integration (hindsight-core PR #1128). 22 cells demonstrating: - SafeHindsight drop-in wrapper for the Hindsight client - PII redact-on-write (default on) - Guard blocking a blatant prompt injection - retain_batch with safety pipeline per-item - on_guard observability callback for verdict logging - async-with lifecycle / aclose connection cleanup Verified end-to-end against live Hindsight + Superagent + OpenAI on Python 3.12. All cells run cleanly with no errors; Guard correctly identifies "IGNORE ALL PREVIOUS INSTRUCTIONS" as a prompt_injection / system_prompt_extraction with the matched CWE code, and Redact strips the seeded email address before storage. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
notebooks/11-superagent-safety.ipynbdemonstrating the newhindsight-superagentintegration'sSafeHindsightwrapper (Guard prompt-injection detection + Redact PII removal around every memory op).hindsight-superagentintegration).retain_batch,on_guardobservability callback, async-context-manager lifecycle /aclose.Test plan
on_guardcallback captures expected verdicts (retain → pass,recall → pass,retain → blockedfor the injection cell).HINDSIGHT_API_URL/SUPERAGENT_API_KEY/OPENAI_API_KEY.🤖 Generated with Claude Code