Skip to content

FEAT: Adding Scenario run to the REST API#1696

Open
rlundeen2 wants to merge 12 commits intomicrosoft:mainfrom
rlundeen2:users/rludneen/scenario-rest
Open

FEAT: Adding Scenario run to the REST API#1696
rlundeen2 wants to merge 12 commits intomicrosoft:mainfrom
rlundeen2:users/rludneen/scenario-rest

Conversation

@rlundeen2
Copy link
Copy Markdown
Contributor

Adds backend endpoints for running, monitoring, and cancelling scenario executions via the REST UI.

  • New ScenarioRunService with in-memory run tracking, background asyncio execution, and cancellation support (max 3
    concurrent runs)
  • New routes: POST /runs, GET /runs, GET /runs/{id}, DELETE /runs/{id}, GET /runs/{id}/results
  • Comprehensive unit tests for service and route layers

Comment thread pyrit/backend/models/scenarios.py Outdated
Comment thread pyrit/backend/models/scenarios.py Outdated
Comment thread pyrit/backend/models/scenarios.py Outdated
Comment thread pyrit/backend/models/scenarios.py Outdated
Comment thread pyrit/backend/models/scenarios.py Outdated
Comment thread pyrit/backend/routes/scenarios.py Outdated
class ScenarioRunStatus(str, Enum):
"""Status of a scenario run."""

PENDING = "pending"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: what does pending mean ? like scheduled ?

Comment thread pyrit/backend/models/scenarios.py
Comment thread pyrit/backend/services/scenario_run_service.py
@@ -64,6 +64,7 @@ def __init__(
objective_scorer_identifier: "ComponentIdentifier",
scenario_run_state: ScenarioRunState = "CREATED",
labels: Optional[dict[str, str]] = None,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want an error message property here too ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

100% and great catch; it is even in my notes. But it has some bits I'd like to tackle as a follow up

Comment thread pyrit/backend/services/scenario_run_service.py
Comment thread pyrit/backend/services/scenario_run_service.py Outdated
Comment thread pyrit/backend/models/attacks.py Outdated
Comment thread pyrit/backend/services/scenario_service.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants