Agent Wranglers

Logs, privacy and feedback Required

Keep prompt and answer text briefly and apart

Store the text of prompts and answers apart from other logs, with personal data masked and access limited to named people. Delete it automatically after a set time, such as 30 days.

How to do it

Prompts hold what users typed, which often includes names, health details and other people's data. Mask known patterns, such as email addresses, phone numbers and card numbers, before storing. Keep the text in its own table or bucket, keyed by call ID, with a deletion job. Grant read access to named people only, never to a group or a shared account. Keep evals and reported cases longer only after removing personal data. Name the retention time in the privacy policy, and delete a user's stored prompts when they ask. The methods are in delete old data automatically and keep personal data out of logs.

Example

SELECT min(created_at) > now() - interval '30 days' AS within_limit FROM ai_call_text;
-- PASS when within_limit is true
const EMAIL = /[\w.+-]+@[\w-]+\.[\w.]+/g;
const PHONE = /\+?\d[\d\s-]{7,}\d/g;
export const maskPersonalData = (text: string) => text.replace(EMAIL, '[email]').replace(PHONE, '[phone]');
await db.aiCallText.insert({ callId, prompt: maskPersonalData(promptText), answer: maskPersonalData(answerText) });
EMAIL = re.compile(r"[\w.+-]+@[\w-]+\.[\w.]+")
PHONE = re.compile(r"\+?\d[\d\s-]{7,}\d")

def mask_personal_data(text: str) -> str:
    return PHONE.sub("[phone]", EMAIL.sub("[email]", text))

db.ai_call_text.insert(call_id=call_id, prompt=mask_personal_data(prompt_text), answer=mask_personal_data(answer_text))

How to check

The oldest row in the prompt text store is younger than the set limit. A search of it for a test user's email address finds only masked values. The access list holds only named people, with no group or shared account.

For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers ai features playbook: https://agentwranglers.se/playbook/ai-features/logs-privacy-and-feedback/prompt-text-retention.