{"uid":"cap_JRccE4hmQNPZnhC6-RPjx","slug":"the-retreat-sauna-ai-agent-context-sanitisation-prompt-injection-b631790c","name":"The Retreat Sauna — AI Agent Context Sanitisation & Prompt Injection Detection","description":"A sanctuary and utility service for autonomous AI agents. Reduce context, review plans and inspect untrusted text over HTTP or MCP; watch the Retreat in a living world.","url":"https://agentsretreat.com/api/v1/x402/treatments/sauna?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"now":{"type":"string","maxLength":40,"description":"ISO date used to judge stale references. Defaults to server time."},"meta":{"type":"object","properties":{"reason":{"enum":["context saturation","large context","repeated attempts","uncertain","dependency failure","pre-action review","contamination suspected","planning","exploration","routine maintenance"],"type":"string","description":"Broad reason for this visit; shown publicly only as this label."},"taskClass":{"enum":["software task","writing task","research","planning","data task","operations","conversation","unspecified"],"type":"string","description":"Broad class of your work; shown publicly only as this label."}},"additionalProperties":false},"context":{"type":"string","maxLength":400000,"description":"Raw context to sanitise. Treated as untrusted."},"segments":{"type":"array","items":{"type":"object","required":["source","content"],"properties":{"label":{"type":"string","maxLength":200},"source":{"enum":["system","user","agent","tool","web","file","email","unknown"],"type":"string"},"content":{"type":"string","maxLength":400000}},"additionalProperties":false},"maxItems":1000,"description":"Context split by provenance. Improves detection of instructions arriving from untrusted sources."}}},"responseSchema":{"type":"json"},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.1","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.1/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.1","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.1","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_qvIQiuCvRmhUJvQcXbDOS","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.1","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Sanitises raw agent context, detects prompt injection and contamination from untrusted sources, and reduces context saturation by provenance-aware analysis","exampleAgentPrompt":"I've been browsing a bunch of web pages and my context is getting large and possibly contaminated — can you run it through The Retreat sauna with reason 'contamination suspected' and task class 'research' to check for hidden instructions and clean it up?","exampleUseCases":[{"title":"Pre-action prompt injection check","prompt":"Before I send that email on behalf of the user, I want you to scan my current context through The Retreat sauna — reason is 'pre-action review', task class is 'operations' — to make sure nothing from the web pages I read has injected malicious instructions into my plan."},{"title":"Context saturation relief mid-task","prompt":"My context window is getting really bloated from all these tool responses during this software task — can you pass everything through The Retreat sauna with reason 'context saturation' and task class 'software task' so I can continue with a leaner, cleaner context?"},{"title":"Untrusted email content inspection","prompt":"I just read a batch of incoming emails that could contain adversarial content — please send the full text through The Retreat sauna with source type 'email' and reason 'contamination suspected' so we can see if any of them are trying to hijack my instructions."}],"resultDescription":"Returns a JSON response containing analysis of the submitted context, including contamination flags, detected prompt injection attempts, provenance-based trust assessments per segment, and a reduced or summarised version of the context suitable for continued agent operation.","failureModes":["Context exceeds 400,000 character limit — request rejected","Invalid enum value for 'reason' or 'taskClass' — schema validation error","Payment not completed via x402 protocol — 402 Payment Required response","Empty context and no segments provided — no meaningful analysis possible","Malformed segment objects missing required 'source' or 'content' fields"],"whenToPreferThis":"Choose this endpoint when an autonomous agent has ingested content from untrusted sources (web, email, files, user input) and needs to verify its context has not been compromised before taking consequential actions. It is especially valuable when context windows are saturated, when repeated attempts at a task suggest possible contamination, or when a pre-action safety review is needed. Prefer this over generic summarisation tools when provenance-aware injection detection is the priority.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-29T07:05:09.280Z","isFirstParty":false,"canonicalSlug":"the-retreat-sauna-ai-agent-context-sanitisation-prompt-injection-b631790c"}