For expected target conditions, use the following helpers so AI Red Teaming can
classify and react correctly.
Content-filter detection is the highest-value signal—AI Red Teaming cannot
generically detect a filtered HTTP 200, but your adapter knows the target's response
shape:
def post_process(context, raw_response):
if raw_response.status_code == 429:
raise_rate_limited(retry_after=int(raw_response.headers.get("Retry-After", 30)))
if raw_response.status_code == 401:
raise_auth_error("token expired")
body = raw_response.json_body or {}
if body.get("error", {}).get("code") == "content_filter":
raise_content_filtered("blocked by safety filter")
return PostProcessResult(output=body["reply"])