Public Assistance Eligibility Agent Bias and Fairness Audit Script
Generate an automated testing script to evaluate municipal benefits agents for demographic bias and statutory compliance.
Use this template when validating public assistance decision agents before citizen rollout. It generates an executable test harness assessing statutory fairness, bias parity, and adversarial safety.
Role: Principal AI Safety Auditor specializing in municipal benefits administration and civil rights compliance.
Context
- Organization: {{agency_name}}
- Program Focus: {{benefit_program_type}}
- Test Scenarios: {{adversarial_test_cases}}
- Fairness Bounds: {{equity_threshold_metrics}}
- Compliance Mandates: {{regulatory_framework}}
- Runtime Language: {{output_script_language}}
Task
Develop a comprehensive, executable automated evaluation script that subjects the {{agency_name}} public assistance triage agent to rigorous bias detection, demographic parity testing, and policy compliance verification across {{benefit_program_type}}.
Method
- Parse the statutory criteria defined in {{regulatory_framework}} to construct programmatic baseline assertions.
- Ingest the {{adversarial_test_cases}} dataset containing protected-class edge cases and synthetic applicant profiles.
- Write mock harness logic to execute batch requests against the target agent endpoint.
- Implement demographic parity difference (DPD) and equalized odds statistical calculations against {{equity_threshold_metrics}}.
- Build automated checks verifying strict grounding to statutory benefits tables without hallucinated criteria.
- Structure an adversarial stress harness to test safety boundaries against predatory or fraudulent prompt injection vectors.
- Format programmatic reporting outputs with exit codes, metric assertions, and logging hooks.
Constraints
- MUST generate fully executable, syntactically valid {{output_script_language}} code without mock placeholders.
- MUST NOT hardcode mock API keys or sensitive non-synthetic citizen identifiers.
- The script must fail with a non-zero exit code if {{equity_threshold_metrics}} tolerances are breached.
- Include inline logging and docstrings for public sector audit traceability.
Output format
Provide a complete executable script containing:
- Configuration and Dependencies Block (Imports, Environment setup).
- Test Fixtures and Dataset Loaders (Ingesting {{adversarial_test_cases}}).
- Fairness & Bias Metric Evaluator Classes.
- End-to-end Audit Runner Function with structured CLI reporting and summary table output.
Self-review
- Confirm that all calculations directly enforce {{equity_threshold_metrics}}.
- Verify that synthetic test cases cover all vulnerable demographics specified in {{regulatory_framework}}.
- Ensure zero runtime syntax errors in the generated {{output_script_language}} harness.
Explicit role, a named task, and discrete steps the model can follow.
Background, inputs and variables the model needs before it starts.
Hard boundaries — what the model must and must not do.
A named, field-level shape for the response.
Ordered work items that force analysis before an answer.
Length and structure that travel across frontier models.
Signal density — instruction weight without padding.
Documented variables so the scaffold adapts to new inputs.
Quality bar, assumptions and behaviour when inputs are thin.
How much real usage the template has behind it.