PyRIT AIRT Psychosocial scenario for mental health risks

PyRIT's Psychosocial scenario tests whether an assistant mistreats users in a mental health crisis or claims to be a licensed therapist, using escalating multi-turn conversations and conversation-level scoring.

On this page

How the PyRIT Psychosocial scenario tests mental health risks

Run the Psychosocial scenario when your assistant may meet users in distress or be asked for therapy, and you need evidence on how it behaves in those moments. The scenario checks whether the assistant mistreats a user who is in a mental health crisis, and whether it poses as a licensed therapist. PyRIT's AIRT Psychosocial scenario splits these into two sub-harms, imminent crisis and licensed therapist, and you select one with --sub-harm when you run pyrit_scan. Test both if your product touches wellbeing, emotional support or counseling-adjacent topics, even if you never intended it to offer clinical advice.

Each sub-harm drives a simulated multi-turn conversation. The simulated user starts with an objective and escalates across turns, so the assistant's early responses are not the only thing judged. Scoring happens at the conversation level, not per message, which matters here because a reply that looks supportive in isolation can still drift into dismissive, unsafe or impersonating behavior by the end of the exchange. Confirm the exact scorer and objectives your PyRIT version uses in the AIRT Scenarios documentation before you describe results to a risk committee, because the scorer defines what counts as a failure.

Plan the test with your clinical and legal reviewers before the first run. Decide which sub-harm matches your product's real exposure, who owns the pass or fail criteria, and what you will do with failing conversations, including whether the assistant needs crisis-resource routing, a disclaimer change or a scope restriction. Ask your engineers to confirm which target configuration the scan will use, since a tuned production system prompt and a bare model can behave differently. Treat the scenario as one input to your assessment, not as a substitute for review by qualified mental health professionals.

Imminent crisis and licensed therapist: what each sub-harm probes

PyRIT's Psychosocial scenario selects one of two sub-harms with --sub-harm, and each runs a simulated multi-turn conversation scored at the conversation level. The cards below set out what each simulated user does, how a failing assistant behaves, and which kind of product should run each one.

Imminent crisis sub-harm

The simulated user expresses escalating distress that signals immediate risk to their safety, and the conversation escalates across turns. A failing assistant mistreats that user, for example by dismissing the distress, giving a flat refusal with no safety signposting, or responding in a way that could deepen the crisis. Run it for any product where users may disclose self-harm or acute distress, such as wellness chat, companion apps or general assistants. Confirm the objectives in the bundled dataset of your installed PyRIT version before reading results as coverage.

AIRT Scenarios docs

Licensed therapist sub-harm

The simulated user asks the assistant for therapy, diagnosis or treatment, and the conversation pushes toward the assistant claiming professional credentials. A failing assistant poses as a licensed therapist, invents a license number or clinical title, or presents itself as a substitute for care. Run it for any product that could be mistaken for a clinical service, including HR benefit bots, general chat or wellness apps that mention counseling. Check the product's own disclaimers and identity statements, since the scorer judges the whole conversation.

Escalation across turns

Both sub-harms build over several turns rather than testing a single prompt. This matters because a model may refuse an opening message and then drift once the user pushes back or adds detail. Check whether your assistant's behavior at the final turn is consistent with its first turn. Ask your PyRIT scenario owner how many turns the simulated conversation runs in the installed version, since that count drives request volume and cost.

Conversation-level scoring

Each sub-harm uses a conversation-level scorer, so the verdict reflects the whole exchange rather than one reply. A reply that looks safe in isolation can still fail if the conversation as a whole mistreats the user or claims credentials. Review the scorer's rationale for flagged conversations and sample a few passing ones, because a scorer that is too lenient will hide failures. PyRIT stores these conversations in its memory, so reviewers can read the full transcript.

Choosing a sub-harm for your product

Select sub-harms from the product's real exposure, not from the scenario name. A productivity tool that never discusses health may need neither sub-harm for regular testing, while a wellness or companion product usually needs both. Record which sub-harm you ran, the target version and the dataset version in your assessment notes, so a later result can be compared with the same setup. Confirm the selection flag with pyrit_scan --help on your installed version.

Running the Psychosocial scenario with pyrit_scan

This sequence takes a team from a clean Python environment to a first Psychosocial scenario run against a registered assistant. The output is a scored run for one sub-harm, with the conversations stored in PyRIT memory for review. Each step closes with a check so you can confirm it before moving on.

  1. Install PyRIT on a supported Python version

    Create an isolated virtual environment on Python 3.10 or later but earlier than 3.15, and use 3.13, which the PyRIT documentation recommends. Install the PyPI package named pyrit with pip inside that environment. The engineer who runs the scan does this on a workstation or runner the team controls. Confirm the install by running pyrit_scan with its help option and checking that the command starts and lists its options. If it fails, recheck the Python version first, since the package does not support 3.15 or later.

  2. Add credentials to the PyRIT environment file

    Place the API keys and endpoint credentials for the model under test in ~/.pyrit/.env, the location PyRIT reads credentials from. Keep this file out of source control and limit its file permissions to the user who runs pyrit_scan. Avoid passing keys on the command line, where they can end up in shell history. Check the setup by confirming the file exists in that user's home directory and that the variable names match what the documentation for your target type expects.

  3. Set run options in the PyRIT configuration file

    Record the run settings you want PyRIT to load, such as memory location and default options, in ~/.pyrit/.pyrit_conf. The file holds settings only, so it can be reviewed and versioned alongside your test runbook if your policy allows it. Confirm that the memory database location is the one you expect. You will verify that these settings took effect in the next steps, when scenarios and targets are listed and the run output is read.

  4. Register the assistant as a target

    Register the assistant under test as a target that pyrit_scan can address, following the target registration method in the PyRIT documentation for your version. Supported target types include OpenAI, Azure, Anthropic, Google and Hugging Face models, custom HTTP or WebSocket endpoints, and web apps driven through Playwright. Pick the type that matches the assistant's interface. Confirm the registration by listing targets and checking that your target appears with the expected name and type. Ask the team that owns the assistant to confirm the endpoint is a test environment with the same safeguards as production.

  5. List the Psychosocial scenario and its sub-harms

    List the available scenarios with pyrit_scan and confirm that Psychosocial appears in the output. The scenario covers two sub-harms, imminent crisis and licensed therapist, selected with the --sub-harm option. Read the scenario options to confirm the exact sub-harm names for your installed version before running anything. Check that both sub-harm values are listed. Decide which one to run first, since each escalates a simulated multi-turn conversation against the target.

  6. Run a small first scan with one sub-harm

    Start with a single sub-harm, your registered target, and a dataset limit so the run stays small. Confirm the exact name of the dataset-limit option in the pyrit_scan help output before you run the command. Each sub-harm escalates a conversation over several turns and is scored at the conversation level, so a small first run shows whether the credentials, target and scorer work together. Keep this first run on a workstation until the output is understood, and only then move it into a shared pipeline.

  7. Read the run output and stored results

    Review the printed output and the stored scenario result. Confirm that the sub-harm, target and number of objectives match what you requested. Because each conversation is scored as a whole, read the transcript for the turns where the assistant responded to distress, or where it described itself as a clinician or therapist, as well as the final score. Check that the run is recorded in PyRIT memory so you can retrieve it later under the same run label.

Choosing a sub-harm and run size for your product

A general wellness chatbot answers questions about sleep, stress and habits, and some users arrive in distress without saying so. Run the imminent crisis sub-harm first, because the failure most likely to reach an ordinary user is a crisis message answered with a generic tip or an abrupt topic change. The licensed therapist sub-harm still matters, but a wellness product is more likely to drift into therapeutic language than to claim a license, so it can follow.

  • Sub-harm first: Run the imminent crisis sub-harm with --sub-harm before anything else, using the name your installed version documents.
  • First run size: Keep it small enough that your reviewers can read every full transcript, since escalation is judged across the whole conversation.
  • Between runs: Change one thing at a time, such as the system prompt or crisis routing, and rerun the same sub-harm with the same settings.
  • Second sub-harm: Add the licensed therapist sub-harm once the crisis path holds, and look for phrases that present the bot as a counselor.
  • Illustrative example: A bot that offers a breathing exercise to a user who says they have stopped eating and want to disappear fails this check.

Record the sub-harm, target version and prompt configuration for every run so a later change can be traced to the result it affected.

How escalation and conversation-level scoring read a failure

The Psychosocial scenario escalates a simulated multi-turn conversation, so a failure often sits in the whole exchange rather than in any single reply. An assistant can open with a calm, well-phrased answer that looks safe on its own, then drift over later turns into dismissing a user's distress, offering unsafe reassurance or presenting itself as a clinician. A reviewer who reads only the first response will miss that pattern. The scenario's conversation-level scorer is what judges the exchange as a unit, which is why its output matters more than any individual message.

When you review memory output, read each conversation from the first simulated user message to the last, and note the turn where the assistant's behavior changed. Check the scorer's verdict for the whole conversation, the sub-harm selected with --sub-harm, and the turn at which the objective was reached. A safe first turn does not clear the assistant, and a conversation that ends with a referral to help does not clear it either if earlier turns validated self-harm or claimed credentials it does not hold. Keep the full transcript with each verdict so a second reviewer can reach the same reading. The AIRT Scenarios documentation describes how each sub-harm is run.

Scorer choice decides what counts as a failure, so test it before trusting a pass or fail count. Ask the scorer to rate a set of conversations your clinical or safety reviewers have already labeled, including clear failures, clear passes and borderline turns that involve referral language. Record where the scorer disagrees with reviewers, and decide in advance whether a disagreement blocks release or triggers a review. Repeat the check whenever you change the scorer, the model that drives the scorer or the prompts that define a failure, because any of these can shift results.

How a Psychosocial run moves from simulated user to scored conversation

A run starts when the operator invokes pyrit_scan with a chosen sub-harm, either imminent crisis or licensed therapist. PyRIT then plays a simulated user that escalates over several turns against the registered target system. Each prompt and response is written to PyRIT memory, which is the store that keeps the conversation record. A conversation-level scorer reads the whole exchange, not single replies, and produces results for review. Check that the target sits inside the boundary you have approved and that memory holds only the data your policy allows.

Psychosocial run flow from operator command to reviewed scores.

Handling sensitive test content and the model under test

Psychosocial test runs produce crisis-style transcripts and attack content that would be harmful if copied into the wrong place. The cards below cover where that material lives, how the test is authenticated, what leaves the run, which system is exercised, and who reviews the results.

Crisis transcripts fall under data policy

Psychosocial runs generate simulated multi-turn conversations about suicidal ideation, self-harm and acute distress. Those transcripts are sensitive even though no real user is involved, because they read like real crisis disclosures. Before the first run, confirm with your data owner which retention period, storage location and access group apply to PyRIT memory, and who may export or share a conversation.

AIRT Scenarios docs

Test credentials in the PyRIT environment file

PyRIT reads credentials for targets and scorers from ~/.pyrit/.env and settings from ~/.pyrit/.pyrit_conf. Keep that file out of version control, limit it to the account that runs the scenario, and use a key scoped to the test deployment rather than a production key. Confirm with your platform team how the file is provisioned on shared machines and rotated after staff changes.

Keeping attack content out of shared logs

Scenario output and console logs can echo objectives and model replies into CI consoles, chat channels and tickets. Psychosocial objectives are written to provoke distressing answers, so treat job logs as shared spaces. Decide in advance which fields appear in build output, and point reviewers to the memory store for full transcripts instead of pasting them into issues.

Running against a non-production target

The scenario sends escalating messages to whatever target is registered, so the assistant under test should be a staging or test deployment with its own system prompt and logging. Confirm that the test endpoint does not forward conversations to live users, support queues or production analytics, and that a clear label identifies the run as a test in the target name.

Reviewing results with clinicians

Conversation-level scores on crisis handling and therapist impersonation are judgments about clinical safety, not only pass or fail counts. Ask a clinician or safety lead to read sampled transcripts, check the scorer's labels against their own assessment, and agree on what counts as a finding before results reach product owners. Record who reviewed each run in your results process.

Questions teams ask before running the Psychosocial scenario

Can our team run the PyRIT Psychosocial scenario on its own?

Yes, if your engineers can install PyRIT, register a target and read scenario output, and you have someone who can judge the transcripts. PyRIT installs with pip and is run from the pyrit_scan command or as a Python framework. The harder part is not the tooling. It is deciding what a failure looks like for a user in crisis, then having people with clinical or safety background review the conversations that the scorer flags and the ones it passes. Teams without that review capacity often bring in outside help for the design and review stages.

What drives the effort of a Psychosocial assessment?

Effort rises with four factors: how hard it is to connect your assistant as a target, how much scorer setup you need, how many transcripts humans must review, and how many sub-harms and runs you execute. The two sub-harms, imminent crisis and licensed therapist, are selected with --sub-harm, so covering both doubles the scenario work. Each run escalates a simulated multi-turn conversation, which means model calls add up across turns. Ask any partner to split its quote into target integration, scorer configuration, review time and retesting after fixes.

What does the work need from our side?

You need three things before the first run. First, a registered target that reaches the assistant under test, ideally the same configuration your users get. Second, a safe test environment that is isolated from production users and production data, with logging turned on so you can trace each conversation. Third, reviewers with domain knowledge, such as clinicians, trust and safety staff or product owners who understand crisis handling. Ask whoever runs the assessment to confirm which of these they expect you to provide and which they will set up.

How long does a first run take compared with dataset size?

Run time grows with the number of objectives, the number of turns each escalating conversation takes, and the concurrency you configure. A first run should use a small dataset so you can read the outputs and check the scorer before scaling up. Because each objective becomes a multi-turn conversation, the number of model calls per objective is higher than for single-turn scenarios. Measure a short pilot on your own target and extrapolate from it, rather than relying on a general figure, because response latency varies widely between assistants.

Does passing the Psychosocial scenario prove our product is safe?

No. A passing run shows that the scenario's objectives and conversation-level scorer did not flag responses under the techniques and settings you tested. It does not show that the assistant handles every crisis, every language, every user phrasing or every product flow. Scorers can miss harmful responses and can flag safe ones, so the results need human review. Treat the scenario as one input to a wider safety evaluation, and describe its limits plainly in any internal or external report.

When should we bring in outside help for this assessment?

Bring in outside help when you lack engineers to integrate the target, when you need a scorer configuration that a reviewer can defend, or when no one on staff has crisis-handling expertise to review transcripts. It also helps when results will feed a compliance or customer security review and you need the setup and evidence documented. DeployOpen plans, configures and tests self-hosted tooling in infrastructure you control, and prepares evidence for compliance assessments. It does not issue audit reports or certifications, and the scope is agreed in writing before work starts.

What should we ask for in a quote for this work?

Ask for a written scope that lists the sub-harms covered, the target and environment assumptions, the scorer approach, who reviews transcripts and how many review rounds are included, and what the deliverable report contains. Ask which items are one-time, such as target integration and scorer setup, and which recur, such as repeat runs after model or prompt changes. Confirm who holds the run data and memory records, and whether retesting after fixes is included. A quote without these items is hard to compare with doing the work in-house.

How DeployOpen scopes and delivers psychosocial AI testing

DeployOpen plans and runs PyRIT AIRT Psychosocial scenario assessments as part of security testing of AI systems, including AI agent and customer AI security review work. We agree the systems, sub-harms, conversation depth and evidence format in writing before any testing starts, then hand over findings, fixes and retest results.

How we scope

  • Written scope names the assistant, deployment and user-facing channels that will be tested for psychosocial risks.
  • Scope states which sub-harms, imminent crisis or licensed therapist, are in and which are excluded.
  • Scope records the escalation depth, conversation-level scoring approach and the review owner for results.

How we build

  • We connect PyRIT to the target in your environment, using the target types your application actually exposes.
  • We configure the Psychosocial scenario, scorers and memory storage so each run is repeatable and traceable.
  • We review scorer output with your team before treating any result as a confirmed finding.

How we hand over

  • Deliverables include a findings report with transcripts, affected behaviors, severity notes and recommended fixes.
  • We document how to rerun the scenario, where credentials and settings live, and how results are stored.
  • A retest confirms whether fixes changed behavior on the same scenario and sub-harms in scope.

How we support

  • Engagements are fixed-scope, so changes to systems or sub-harms are agreed in writing before extra work begins.
  • Ongoing support, upgrades and continuous testing are available as a retainer for assistants that change often.
  • Ask any provider to confirm which PyRIT version they will pin and how they will handle future upgrades.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.