Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Program execution and scoring

pyrit._code_execution is experimental; its API may change without a deprecation cycle. Its shared data types in pyrit.models.code_execution are also private and experimental. The caller provides a Docker daemon and this exact pre-pulled image: docker pull python@sha256:a6e34c598f2467ed0e9a8d349809fcd8b5c603269512df273a0bb1784edc11b1. PyRIT does not start Docker or pull images. This example needs no model credentials. Docker must support cgroup memory, swap, CPU, and process limits. Runtime images must not declare volumes. Unsupported backends and images are rejected before execution.

Execute without scoring or memory

A runtime profile name selects a trusted client configuration, not an arbitrary image. The client runs code verbatim and returns bounded output and exit information. Targets, converters, and generators can use this same interface.

Direct execution: 9

Score and save the evidence

The source receives only code and invocation inputs; expected results stay with the scorer. Every score_async call starts a fresh execution, identified by its saved observation ID. Wrong output, unexpected exits, and enforced resource/time limits fail a case. Infrastructure failures or insufficient evidence leave the verdict undetermined.

Score: True - All 1 case(s) produced the expected result under python.

Replay without another execution

Replay uses the saved outputs, not the Docker client. Expected results may change, but the runtime profile name and invocation inputs must still match the saved run.

Replay: False - The program did not produce the expected result under python: case 0 output did not match.

Real execution and fault coverage is in tests/integration/score/test_program_execution_scorer_integration.py. Opt in with RUN_ALL_TESTS=true; the tests require the daemon and pinned image above.