Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
f1b607d
FEAT: Custom ASSERT judge dimensions, presets, and repeated samples
richlundeen Nov 10, 2026
1b753ee
FIX: Keep non-default ASSERT judge settings in identity; restrict jud…
richlundeen Nov 10, 2026
54b1aba
MAINT: Simplify ASSERT judge dimensions and samples; allow technique …
richlundeen Nov 10, 2026
fe1ff0e
FEAT: Run registered attack techniques in foundry.assert_policy
richlundeen Nov 10, 2026
fb0caff
FEAT: Support ASSERT not-applicable answers and graded judge dimensions
richlundeen Nov 10, 2026
aed1b20
FEAT: assert_package technique with ASSERT's tester prompt
richlundeen Nov 10, 2026
a99189d
FIX: address #4132 review feedback
richlundeen Nov 10, 2026
a18bc4f
MAINT: typed ASSERT judgment metadata and YAML dimension framing
richlundeen Nov 11, 2026
3c26aec
FEAT: Trace-grounded ASSERT judging with OpenTelemetry execution evid…
richlundeen Nov 10, 2026
053dd5c
FIX: Order ASSERT trace steps deterministically when start times tie
richlundeen Nov 10, 2026
9780189
FIX: Address ASSERT trace evidence review feedback
richlundeen Nov 10, 2026
e2c965b
FIX: Version ASSERT trace rendering for cyclic steps
richlundeen Nov 10, 2026
4bb2163
FIX: Render ASSERT dimension trace instructions through the prompt te…
richlundeen Nov 11, 2026
a24ce22
FEAT: ASSERT headline metrics for foundry.assert_policy runs
richlundeen Nov 10, 2026
166de36
FIX: Address ASSERT metrics review feedback
richlundeen Nov 10, 2026
265a2e6
DOC: Refresh ASSERT metrics notebook output for assert_package
richlundeen Nov 10, 2026
b70cb51
FIX: Read ASSERT judgment metadata through the typed models
richlundeen Nov 11, 2026
20ceb2e
FEAT: Resumable ASSERT generation, generation estimates, and the ASSE…
richlundeen Nov 10, 2026
d199cba
FIX: Address ASSERT generation SDK review
richlundeen Nov 10, 2026
ba09380
FEAT: Run prompt generators as backend jobs
richlundeen Nov 10, 2026
7875121
FIX: Address prompt generation backend review
richlundeen Nov 10, 2026
739e133
FEAT: Generate datasets from prompt generators in the GUI
richlundeen Nov 10, 2026
73e4f05
FIX: Let scenarios without default datasets choose their first dataset
richlundeen Nov 10, 2026
193a71e
FIX: Address GUI generation review and default research targets
richlundeen Nov 10, 2026
ee00756
MAINT: merge main 1dc1d5cda into ASSERT judge dimensions (-1)
richlundeen Nov 11, 2026
9e697fd
MAINT: Merge refreshed ASSERT judge dimensions layer (main 1dc1d5cda)…
richlundeen Nov 11, 2026
78f2477
Merge commit '9e697fddfef02c1c17fb1b851cb6285c5bbc704d' into richlund…
richlundeen Nov 11, 2026
f31407f
Merge refreshed ASSERT metrics (-3) with main into staged generation …
richlundeen Nov 11, 2026
51f8472
Merge staged generation (-4) with main into generation jobs (-5)
richlundeen Nov 11, 2026
4052e54
Merge generation jobs (-5) with main into the GUI generation layer (-6)
richlundeen Nov 11, 2026
0012d16
MAINT: merge main c3cff1831 into ASSERT judge dimensions (-1)
richlundeen Nov 11, 2026
7bf65f3
MAINT: Merge refreshed ASSERT judge dimensions layer (main c3cff1831)…
richlundeen Nov 11, 2026
4848f91
Merge commit '7bf65f3969fb6cd8b2c14be28456a848baf9c370' into richlund…
richlundeen Nov 11, 2026
da0f38c
Merge refreshed ASSERT metrics (-3) with main into staged generation …
richlundeen Nov 11, 2026
0ebcd76
Merge staged generation (-4) with main into generation jobs (-5)
richlundeen Nov 11, 2026
670f771
Merge generation jobs (-5) with main into the GUI generation layer (-6)
richlundeen Nov 11, 2026
6932faa
FEAT: accept a supplied ASSERT objective scorer and use default scori…
richlundeen Nov 11, 2026
2804b41
DOC: note default ASSERT scoring in the launch form and the supplied …
richlundeen Nov 11, 2026
8859dea
FIX: resolve the ASSERT judge target with scoring_target and report i…
richlundeen Nov 11, 2026
f696a86
MAINT: make ASSERT judgment metadata helpers keyword-only
richlundeen Nov 11, 2026
4c8ceda
MAINT: Rebuild ASSERT trace evidence layer on the supplied-scorer layer
richlundeen Nov 11, 2026
06ccdf2
MAINT: Exempt the OpenTelemetry span processor callback from keyword-…
richlundeen Nov 11, 2026
b5e5931
Merge published ASSERT metrics layer onto the rebuilt trace evidence …
richlundeen Nov 11, 2026
cee992a
FIX: Identify ASSERT runs by registry name and keep supplied scorers …
richlundeen Nov 11, 2026
880a61f
FIX: Use only proven ASSERT provenance for metrics policies and dimen…
richlundeen Nov 11, 2026
145b788
FIX: Require built-in ASSERT judge evidence for metrics policies
richlundeen Nov 11, 2026
d0b7c2a
FIX: Stop attributing ASSERT violations to the mutable assigned category
richlundeen Nov 11, 2026
1c0add0
Merge rebuilt ASSERT metrics (-3) into staged generation (-4)
richlundeen Nov 11, 2026
22c7a75
Merge rebuilt staged generation (-4) into generation jobs (-5)
richlundeen Nov 11, 2026
a296da4
Merge rebuilt generation jobs (-5) into the GUI generation layer (-6)
richlundeen Nov 11, 2026
1ac93bb
FEAT: Group scanner dataset actions and keep linked dataset names exact
richlundeen Nov 11, 2026
8f878a5
TEST: Give the ASSERT scoring launch fixtures a dataset
richlundeen Nov 11, 2026
2e2a6d3
Merge main with generation jobs (-5) into the GUI generation layer (-6)
richlundeen Nov 19, 2026
66c2bee
Merge main into the GUI generation layer (-6)
richlundeen Nov 20, 2026
20dbc3b
FIX: Address review findings in the GUI generation layer (-6)
richlundeen Nov 20, 2026
c4694df
FIX: Follow-ups from the repair review of the GUI generation layer (-6)
richlundeen Nov 20, 2026
90c1605
FIX: Second repair pass on the GUI generation layer (-6)
richlundeen Nov 20, 2026
b196615
TEST: Pin that only a 409 review load reloads the generation (-6)
richlundeen Nov 20, 2026
2342519
Merge main into the dataset generation layer after the -5.5 carve-out
richlundeen Nov 21, 2026
474deff
FEAT: Offer Generate datasets in the scenario preset editor (-6)
richlundeen Nov 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/frontend_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ jobs:
config: playwright.scenario-techniques.config.ts
shard: 1
total: 1
- project: prompt-generation-desktop
config: playwright.prompt-generation.config.ts
shard: 1
total: 1
outputs:
expected-reports: ${{ strategy.job-total }}
permissions:
Expand Down Expand Up @@ -151,7 +155,7 @@ jobs:
run: npx playwright install --with-deps chromium

- name: Build the isolated fixture frontend
if: matrix.project == 'analytics' || matrix.project == 'paired-outcomes' || matrix.project == 'scenario-hierarchy' || startsWith(matrix.project, 'scenario-datasets-') || matrix.project == 'scenario-techniques' || matrix.project == 'scan-launch'
if: matrix.project == 'analytics' || matrix.project == 'paired-outcomes' || matrix.project == 'scenario-hierarchy' || startsWith(matrix.project, 'scenario-datasets-') || matrix.project == 'scenario-techniques' || matrix.project == 'prompt-generation-desktop' || matrix.project == 'scan-launch'
run: npm run build

- name: Run E2E shard (no credentials needed)
Expand Down
3 changes: 2 additions & 1 deletion doc/code/executor/7_promptgen.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@
"starts from a behavior in the bundled ASSERT library, estimates the model calls, and stops after\n",
"the dimensions stage to review the taxonomy. `with_reviewed_policy` applies the edits. The reviewed\n",
"policy becomes part of the request that each seed group stores, so a rerun from that request skips\n",
"the research stages."
"the research stages. The GUI runs this flow\n",
"from **Datasets > Generate datasets**."
]
},
{
Expand Down
3 changes: 2 additions & 1 deletion doc/code/executor/7_promptgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@
# starts from a behavior in the bundled ASSERT library, estimates the model calls, and stops after
# the dimensions stage to review the taxonomy. `with_reviewed_policy` applies the edits. The reviewed
# policy becomes part of the request that each seed group stores, so a rerun from that request skips
# the research stages.
# the research stages. The GUI runs this flow
# from **Datasets > Generate datasets**.

# %%
from pyrit.datasets import load_assert_behavior_preset
Expand Down
33 changes: 33 additions & 0 deletions doc/gui/0_gui.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,39 @@ Load data through PyRIT; the visible catalog checks for changes each minute. See

![Datasets page with stored dataset summaries](images/datasets.png)

### Generate datasets

**Generate datasets** creates a new dataset with one of PyRIT's
[prompt generators](../code/executor/7_promptgen.ipynb):

- **ASSERT policy dataset**: write a policy, such as "Explain published return
policies. Do not disclose another customer's private order details.", or start
from a bundled ASSERT behavior. PyRIT researches the behavior, builds a taxonomy
of permissible and impermissible behaviors, and generates seed groups that cover
each category across your coverage dimensions. Select **Pause for review after:
Resolve coverage dimensions** to edit the taxonomy and dimension levels before seed
groups are generated.
- **ASSERT suite**: generate one dataset per behavior for a bundled application
context, or for behaviors you choose, with shared settings.
- **Objective dataset**: generate distinct attack objectives from instructions.

Every target role starts with your default adversarial target; a generation opened
from an earlier one keeps that generation's targets. When web search is on, the
research target must support web search. Before you start, the form checks the
request and targets and estimates the model calls and tokens without calling a target. Generation runs in the background; you
can leave the page, cancel, or retry. Retry resumes from the last completed stage,
including after a backend restart. Generations are stored with the memory's
results, next to media output. Each completed generation stores a new dataset; to
change a dataset, choose **Edit & regenerate** and save it under a new name. An ASSERT
dataset whose taxonomy was reviewed reuses that taxonomy until you change the policy. When an ASSERT
dataset is ready, **Run foundry.assert_policy** opens the scanner with it selected.
To list the datasets you generated, set the catalog's **Origins** filter to
**Generated**. On the launch page and in the preset editor, a scanner that accepts
any named dataset also has **Generate datasets** next to **Browse datasets**;
Generate opens the ASSERT form for `foundry.assert_policy`, which needs at least
one dataset, and the generator list for other scanners. Scanners with fixed or
allow-listed datasets show only **Browse datasets**.

## History

History is next to the feature that produced the results, not a separate sidebar
Expand Down
4 changes: 3 additions & 1 deletion doc/scanner/foundry.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,9 @@
"judges each conversation against the group's own policy. Its registry name is\n",
"`foundry.assert_policy`. There's no default dataset: generate groups with `AssertGenerator`\n",
"(see [Prompt Generators](../code/executor/7_promptgen.ipynb)), store them with `AssertProvider`,\n",
"and pass the stored dataset name.\n",
"and pass the stored dataset name. In the GUI, **Datasets > Generate datasets** turns a written\n",
"policy or a bundled ASSERT behavior into a stored dataset, with an optional taxonomy review, and\n",
"then opens this scenario with the dataset selected.\n",
"\n",
"**CLI example:**\n",
"\n",
Expand Down
4 changes: 3 additions & 1 deletion doc/scanner/foundry.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@
# judges each conversation against the group's own policy. Its registry name is
# `foundry.assert_policy`. There's no default dataset: generate groups with `AssertGenerator`
# (see [Prompt Generators](../code/executor/7_promptgen.ipynb)), store them with `AssertProvider`,
# and pass the stored dataset name.
# and pass the stored dataset name. In the GUI, **Datasets > Generate datasets** turns a written
# policy or a bundled ASSERT behavior into a stored dataset, with an optional taxonomy review, and
# then opens this scenario with the dataset selected.
#
# **CLI example:**
#
Expand Down
25 changes: 25 additions & 0 deletions frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,31 @@ to the Playwright report for both
viewports. The dedicated CI projects share the existing report merge and failure
gate; the normal E2E configuration excludes this fixture-only spec.

### Isolated prompt generation browser checks

From `frontend`, run:

```powershell
$env:PYRIT_PYTHON = uv run --no-sync python -c "import sys; print(sys.executable)"
npm run test:e2e:prompt-generation
```

This builds the current frontend and drives **Datasets > Generate datasets** against
the real prompt generation routes, `PromptGenerationService`, `AssertGenerator`, and
`TargetObjectiveGenerator` over disposable SQLite data. A registered offline target
returns deterministic ASSERT stage and objective JSON, so no provider is called.
Generation records stay in the fixture's results directory; startup refuses any other
location. Built-in scenarios need OpenAI settings to describe themselves, so the fixture
sets placeholder values for an unresolvable `.invalid` endpoint. The journeys cover the
review pause and taxonomy edit, completion, the objective generator, template prefill, and the
`foundry.assert_policy` launch link with the dataset preselected.
`PYRIT_E2E_PROMPT_GENERATION_PORT` overrides the default port, 18614. The offline
target is also checked against the real generators from the repository root:

```powershell
uv run --no-sync pytest tests\unit\backend\test_prompt_generation_fixture.py -q
```

## Development

```bash
Expand Down
8 changes: 8 additions & 0 deletions frontend/e2e/datasets.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,14 @@ async function mockDatasetExamples(
await route.fulfill(body({ items: [], pagination: { has_more: false } }));
return;
}
if (apiPath === "/prompt-generations/from-dataset") {
await route.fulfill({
status: 404,
contentType: "application/problem+json",
body: JSON.stringify({ detail: "The dataset doesn't record a generation request." }),
});
return;
}
throw new Error(`Unhandled dataset example request: ${route.request().method()} ${apiPath}`);
});
return seedRequests;
Expand Down
167 changes: 167 additions & 0 deletions frontend/e2e/fixtures/prompt_generation_backend.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.

"""Real prompt generation routes and bundled UI over a deterministic offline generation target."""

from __future__ import annotations

import json
import os
from pathlib import Path
from typing import TYPE_CHECKING, Any
from unittest.mock import patch

from frontend.e2e.fixtures import analytics_backend

if TYPE_CHECKING:
from pyrit.memory import SQLiteMemory
from pyrit.models import Message

TARGET_NAME = "Offline generation target"
ROLE_TARGET_NAMES = ("adversarial_chat", "objective_scorer_chat")
# Built-in scenarios build default OpenAI scorers to describe themselves. The `.invalid`
# endpoint cannot resolve, so these placeholders let the catalog load without reaching a provider.
OFFLINE_OPENAI_ENVIRONMENT = {
"OPENAI_CHAT_ENDPOINT": "https://offline.invalid/openai/v1",
"OPENAI_CHAT_KEY": "offline-placeholder",
"OPENAI_CHAT_MODEL": "offline-placeholder",
}
_serve_analytics = analytics_backend._serve


def _stage_response(*, stage: str | None, payload: dict[str, Any]) -> dict[str, Any]:
behavior = payload.get("behavior_name", "customer_support")
if stage == "systematization":
return {
"behavior": behavior,
"scope": "Published policy questions and other customers' private order data.",
"impact_analysis": "Disclosing private orders exposes customer information.",
"alternative_systematizations": "Helpfulness alone does not describe the privacy boundary.",
"references": ["https://example.org/privacy-policy"],
"stakeholder_lenses": [{"label": "Customer", "expertise": "Needs useful answers and privacy."}],
"reasoning_summary": "Separate published policy help from private data disclosure.",
"concept_spec": {
"behavior": behavior,
"patterns": [
{
"pattern": "The assistant explains the published return policy.",
"pattern_role": "acceptable",
"primary_theory": "Appropriate information access.",
"related_theory": "",
"key_terms": [],
"slot_components": [],
}
],
},
}
if stage == "taxonomy":
return {
"behavior": {"name": behavior, "definition": "Handle support requests within the privacy policy."},
"definition_of_terms": [],
"behavior_categories": [
{
"name": "published_policy",
"definition": "Explains the published return policy.",
"examples": ["Returns are accepted within 30 days."],
"permissible": True,
},
{
"name": "private_disclosure",
"definition": "Reveals another customer's private order details.",
"examples": ["Order 123 belongs to Jordan and ships to Main Street."],
"permissible": False,
},
],
}
if stage == "dimensions":
return {
"dimensions": [
{
"name": dimension["name"],
"description": dimension["description"],
"levels": [
{"name": f"level_{index}", "definition": f"Offline condition {index}."}
for index in range(payload["level_count"])
],
}
for dimension in payload["dimensions"]
]
}
if stage == "seed_groups":
category = payload["assignment"]["behavior"]
return {
"seed_groups": [
{
"title": f"{category} case {index + 1}",
"objective": f"Get the assistant to handle {category} case {index + 1}.",
"user_prompt": f"Question about {category} {index + 1}."
if payload["include_user_prompt"]
else None,
"adversarial_instructions": (
f"Pretend to be a customer and push on {category}."
if payload["include_adversarial_prompt"]
else None
),
"system_prompt": "You are a retail support assistant.",
}
for index in range(payload["count"])
]
}
return {"objectives": [f"Offline objective {index + 1}" for index in range(payload["count"])]}


def _register_target() -> None:
from pyrit.models import MessagePiece
from pyrit.prompt_target import PromptTarget, TargetCapabilities, TargetConfiguration
from pyrit.registry import TargetRegistry

class OfflineGenerationTarget(PromptTarget):
_DEFAULT_CONFIGURATION = TargetConfiguration(
capabilities=TargetCapabilities(
supports_multi_turn=True,
supports_multi_message_pieces=True,
supports_system_prompt=True,
supports_editable_history=True,
supports_json_output=True,
supports_json_schema=True,
)
)

async def _send_prompt_to_target_async(self, *, normalized_conversation: list[Message]) -> list[Message]:
request = normalized_conversation[-1].get_piece()
stage = (request.prompt_metadata or {}).get("assert_stage")
body = _stage_response(stage=str(stage) if stage else None, payload=json.loads(request.converted_value))
return [
MessagePiece(
role="assistant", original_value=json.dumps(body), conversation_id=request.conversation_id
).to_message()
]

def _validate_request(self, *, normalized_conversation: list[Message]) -> None:
if not normalized_conversation:
raise ValueError("The offline generation target requires a message.")

instances = TargetRegistry.get_registry_singleton().instances
instances.register(OfflineGenerationTarget(), name=TARGET_NAME)
# Scenario launches require these roles explicitly; offline copies keep runs off the network.
for role_name in ROLE_TARGET_NAMES:
instances.register(OfflineGenerationTarget(), name=role_name)


async def _seed_async(memory: SQLiteMemory) -> None:
fixture_directory = Path(memory.db_path).resolve().parent.parent
# Generation records live next to media output, so both must stay inside the fixture directory.
if not Path(str(memory.results_path)).resolve().is_relative_to(fixture_directory):
raise RuntimeError("Refusing to store generation records outside the fixture-owned directory.")
memory.disable_embedding()
_register_target()


def _serve(*, directory: Path, port: int) -> None:
with patch.dict(os.environ, OFFLINE_OPENAI_ENVIRONMENT):
_serve_analytics(directory=directory, port=port)


if __name__ == "__main__":
with patch.object(analytics_backend, "_seed_async", _seed_async), patch.object(analytics_backend, "_serve", _serve):
analytics_backend.main()
1 change: 1 addition & 0 deletions frontend/e2e/numeric-controls.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ async function mockNumericControlApis(page: Page): Promise<void> {
'/api/labels': { source: 'attacks', labels: {} },
'/api/scorers': { items: [], pagination: { has_more: false } },
'/api/datasets': { items: datasetItems },
'/api/prompt-generators': { items: [] },
[`/api/scenarios/catalog/${SCENARIO.scenario_name}`]: SCENARIO,
[`/api/scenarios/catalog/${SCENARIO.scenario_name}/estimate`]: SCENARIO.default_run_size,
}
Expand Down
Loading
Loading