Before an AI application sends a query to a search API or a URL to a reader, check which sources and data fields the workflow may use. Apply the same policy to the output it saves. A page converted to Markdown can still contain personal or restricted information.
Decide what the application may send
Write down the purpose, the allowed sources, and the fields required for that purpose. In a catalog check, the agent may need a product URL, an advertised price and the time it was observed. A customer email address in the search query or page body belongs in a separate review path. Check the input before sending it and the returned fields before writing to storage.
Use the approved policy for your organization, source and jurisdiction. Have the appropriate owner resolve questions about the basis for processing, source permissions, retention and transfers. The web-data provider acceptance checklist covers questions to settle before integration.
Keep the decision record small
Record an application-generated identifier for the source record, the registered purpose, the outcome and the policy revision. Put approved evidence in separate storage with its own access rules and retention period. A source record can hold a URL if your policy allows it. Keep query strings, page bodies, model output and credentials out of this decision event.
The following local example validates a fixed set of fields. It uses a synthetic record ID and writes no files.
from uuid import UUID
OUTCOMES = {"allow", "needs_review", "skip"}
PURPOSES = {"catalog_check", "public_release_research"}
REVISIONS = {"source-policy-v3"}
def safe_event(record_id, purpose, decision, policy_revision):
if purpose not in PURPOSES or decision not in OUTCOMES:
raise ValueError("Unregistered purpose or decision")
if policy_revision not in REVISIONS:
raise ValueError("Unknown policy revision")
return {
"source_record_id": str(UUID(record_id)),
"purpose": purpose,
"decision": decision,
"policy_revision": policy_revision,
}
fixture_id = "ea830c31-adca-4c96-8c78-deadbeef0032"
event = safe_event(
fixture_id, "catalog_check", "needs_review", "source-policy-v3"
)
assert event["source_record_id"] == fixture_id
assert event["decision"] == "needs_review"
assert set(event) == {"source_record_id", "purpose", "decision", "policy_revision"}
Test the points where data leaves the application
- Use a synthetic query with a disallowed field and check that the request stays in review.
- Return a synthetic response with an unexpected field and check that the application records the decision without retaining that field.
- Read the event from the roles that should be able to investigate it. Check separately that expired evidence is removed by the retention process.
For the preceding choice of whether the agent should read, research or act, use the web-access architecture guide. Record decision events at the point where the selected workflow sends or stores data.