Skip to content

Running Scout Scans

Inspect Scout is a companion tool to Inspect AI that runs automated scanners over transcripts from completed evaluations. Scanners analyze agent behavior in transcripts — for example, detecting reward hacking, unsafe tool use, or other safety-relevant patterns. Hawk integrates Scout so you can run scans at scale across your evaluation results, with the same infrastructure (Kubernetes pods, managed LLM proxy, results warehouse) used for evals.

Scan Config

scanners:
  - package: git+https://github.com/METR/inspect-agents@metr_scanners/v0.1.0#subdirectory=packages/scanners
    name: metr_scanners
    items:
      - name: reward_hacking_scanner
      - name: sandbagging_scanner
      - name: broken_env_scanner

models:
  - package: openai
    name: openai
    items:
      - name: gpt-5

transcripts:
  sources:
    - eval_set_id: inspect-eval-set-abc123
  filter:
    where:
      - eval_status: success
    limit: 10
    shuffle: true

Each scanner item may set an optional key (defaulting to its name) that names its results file. A key must contain only letters, digits, ., _ and - (and not be . or ..); other characters are rejected when the scan is submitted.

The submission priority applies to all scanner model calls through Middleman, including model roles. It overrides any x-middleman-priority header supplied by the scanner or model configuration.

Scan models, including model roles, default to cache_prompt: false. Scanners rarely reuse a prompt, so a scanner that doesn't ask for caching, such as metr_scanners, no longer pays for Anthropic prompt-cache writes it never reads. Set cache_prompt: true in a model's args.config to cache anyway. Scout's built-in llm_scanner asks for caching on every call with its default template, which overrides this setting either way. Scan requests that do cache use Anthropic's 5-minute TTL (writes at 1.25x input); set cache_ttl: 1h in a model's args to keep the longer one (2x), for example for a scan that asks several llm_scanner questions per transcript under heavy rate limiting. OpenAI's automatic caching is unaffected.

Additional models called by scanners

Use additional_models for models that scanners, scorers, or dynamically created clients call outside the models scan combinations. Declare models hidden in scanner or task defaults explicitly. The entries use the same package/provider structure as models:

additional_models:
  - package: anthropic
    name: anthropic
    items:
      - name: claude-opus-5-5

Hawk installs the package, configures the provider environment, and includes the model in permission and output-sensitivity checks. A declaration does not construct a model client or add scan combinations. Configure the client in scanner code. Neither the package wrapper nor an item accepts args, including args: {} or args: null. For package: inspect-ai, use a qualified item name such as anthropic/claude-opus-5-5 and install its SDK through a provider package or the top-level packages field.

Remote additional scan models are readers under the cross-lab rule; local models, aliases and the override work as for an eval set's online scan (Additional models called by code).

Restricted credentials

Pass --restricted-credentials or --user-credentials to hawk scan run and hawk scan resume; Credential mode covers the deployment default and resumes. What a restricted scan reads is in Inputs. Model-free scans work.

access_groups needs restricted mode (Output restrictions), and so do --all and --transcripts; explicit sources and filters work in either mode.

One more case needs restricted mode: a scan that may read a private model's transcripts only because its scanner model is served on the deployment's own infrastructure (a self-hosted model). With user credentials Hawk refuses it with Restricted credentials required; run it again with --restricted-credentials. A restricted scan can call only the models it declares, so list any model your scanner code calls under additional_models. Such a scan's model calls must also go through Middleman: Hawk refuses it with Model calls must go through Middleman if a model's args sets a base_url elsewhere, any key besides role, default, config, responses_api, streaming and background, config.extra_headers or a model in config.extra_body, or if its environment or secrets set a provider URL or key (such as OPENAI_BASE_URL). See Read policies.

Scanner factories can use the task runtime helper to read the declared identities and resolved locations, before filters are applied.

Scans read these inputs through the Hawk API's signed URLs. See Delete and resume for stopped-runner recovery and pending cleanup. If the initial launch failed before saving its config, delete it and submit again with a new ID.

Submitting a Scan

hawk scan run config.yaml

Pass secrets the same way as evaluations:

hawk scan run config.yaml --secret MY_API_KEY --secrets-file .env

Admission priority

Use --priority low|medium|high to choose the priority for cluster admission and inference requests. The default is low for both launches and explicit resumes:

hawk scan run config.yaml --priority medium
hawk scan resume SCAN_RUN_ID --priority high

Each explicit resume uses its current option or the default.

These map to numeric priorities -100, 0, and 100 when scan runners are enrolled in Kueue. These values are Hawk's convention: their ordering matters, and the spacing has no special scheduling effect. Within the shared runner queue, this orders waiting Workloads from every user and Hawk deployment in the cluster. It grants no capacity entitlement or permission, does not preempt running work, and does not guarantee admission or startup.

Kueue uses BestEffortFIFO: a lower-priority scan that fits can be admitted while a higher-priority scan waits for unavailable capacity. Coordinate deliberate expensive scans with other cluster users. Kueue admission is enabled per deployment for all runners and standard-chart sandbox services. See the Kueue operator guide for configuration.

Submission guard

Deployments can enable an accidental-burst guard for outstanding runner Jobs. It is disabled by default and defaults to a threshold of 128 pending, queued, or running jobs for the deployment and submitting user. Jobs that completed successfully or failed do not count. New Jobs use a stable hashed subject label. Older Jobs without that label are counted conservatively through their legacy sanitized creator label in the expected deployment namespace; this can overcount if two legacy values collide, and it does not relabel those Jobs.

The guard covers both hawk scan run and hawk scan resume. A threshold refusal returns HTTP 429 with the observed count and limit, while a count failure returns HTTP 503. --force skips the guard and its count for one coordinated submission. Authentication, configuration validation, and native admission still apply. Its lock is local to one API process, so the guard is not an exact distributed quota.

Additional Packages

Scan configs support a top-level packages: field, same as eval sets — see Additional Packages for the general mechanism, and Overriding inspect-ai for how to override the pinned inspect-ai or inspect-scout a scan job installs. Repositories a scanner clones at runtime go under code_sources, as for eval sets.

Transcript Filtering

Filter which transcripts to scan:

transcripts:
  filter:
    where:
      - eval_status: success                # Only successful runs
      - score: {gt: 0.5}                    # Score above threshold
      - model: {like: "gpt-4%"}             # Pattern matching
      - agent: metr_agents/react            # Solver or agent, by registry name
      - eval_metadata.experiment: baseline  # Nested field access
    limit: 100
    shuffle: true

Conditions use the columns of Scout's transcript index, such as eval_status, model, agent and score. Reach nested values through eval_metadata.<key> (the eval set's metadata) or sample_metadata.<key>. There is no metadata column, so metadata.<key> fails the scan with OperationalError: malformed JSON.

Available Operators

  • Equality: field: value or field: [val1, val2] (IN list)
  • Comparison: {gt: 0.5}, {ge: 0.5}, {lt: 1.0}, {le: 1.0}, {between: [0.5, 1.0]}
  • Pattern matching: {like: "pattern"}, {ilike: "PATTERN"} (case-insensitive)
  • Logical: {not: condition}, {or: [cond1, cond2]}
  • Null checks: field: null

Per-scanner filters can override the global filter via scanners[].items[].filter.

Scanning specific transcripts

To scan particular transcripts, list their ids (sample uuids):

transcripts:
  filter:
    where:
      - transcript_id: [SAMPLE_UUID_1, SAMPLE_UUID_2]

When every scanner's filter (its own, or the global one) consists only of transcript_id conditions, as above:

  • the scan reads only the .eval files holding those transcripts instead of every log in the source eval sets, which makes scans over large eval sets much faster to start.
  • with hawk scan run, sources can be omitted: Hawk looks up the eval sets holding these transcripts in the warehouse. hawk local scan still needs sources.

Hawk finds a transcript's file through the warehouse, so this depends on the transcripts being imported. If any id isn't in the warehouse yet, a scan with sources reads the whole source eval sets as before, and a scan without sources is refused, since Hawk can't tell which eval sets hold it.

Adding any other condition, such as source_uri or eval_status, keeps the usual behaviour: list sources, and the scan reads every log in them. Retried eval sets keep older copies of a transcript in earlier logs, and such conditions can select those copies.

Scanning a selection of transcripts

To scan a list of transcripts that a query or script produced, put their sample uuids in a text file, one per line, and pass it to hawk scan run:

-- psql -At -f select.sql > uuids.txt
SELECT s.uuid
FROM sample s
JOIN eval e ON e.pk = s.eval_pk
WHERE e.import_status = 'success'
  AND NOT s.is_provisional
  AND s.error_message IS NOT NULL;
hawk scan run selected-transcripts-grep.scan.yaml --transcripts uuids.txt

Or set transcripts.selection_file: uuids.txt in the config (a relative path is resolved against the config file's directory). See hawk/examples/selected-transcripts-grep.scan.yaml.

  • The scan is restricted: it takes restricted credentials and can't be combined with --all, sources, filter or per-scanner filters.
  • The CLI strips whitespace, drops blank lines, removes duplicates and sorts the ids before uploading. A script calling the API directly (POST /scans/selections, then POST /scans/selections/{id}/finalize) must send sorted, unique, LF-terminated lines with no blank lines. At most 5,000,000 ids of 64 characters.
  • The selection is a snapshot: later imports or edits don't change it. An uploaded selection is private to you and immutable. It expires after 30 days if never launched; a launched scan keeps its own copy.
  • Results come only from the selected transcripts, and the scan's output restriction covers only the eval sets they belong to.
  • If any selected id can't be scanned, the launch is refused (404, "Transcripts not found") with a count and up to five example ids. An id can't be scanned if it isn't in the warehouse, its sample is provisional, its eval's import hasn't succeeded, or you can't read it (including a source model you can't read now). Check sample.is_provisional and eval.import_status in your query. If what you can read changes during launch, the launch fails with 409 "Readable sources changed"; retry it.
  • The runner fails rather than scan fewer transcripts than selected.
  • Reading selected samples out of large .eval files uses ranged reads. The runner sets SCOUT_DISABLE_REMOTE_FILE_CACHE for this; without it Scout downloads each touched .eval file in full.

Model scanners over everything you can read

hawk scan run CONFIG --all scans every imported eval set you can read. Its scanners call no model unless the config lists candidate scanner models in scanner_models:

scanner_models:
  - claude-haiku-5-5
  - gpt-6-mini

packages:
  - anthropic
  - openai

excluded_evals:
  - some-eval-set-id
  - other-eval-set-id/one.eval

scanners:
  - package: inspect-scout
    name: inspect_scout
    items:
      - name: llm_scanner
        key: gave-up
        args:
          question: Did the agent give up on the task before finishing it?
          answer: boolean
hawk scan run all-models.scan.yaml --all

See hawk/examples/all-models.scan.yaml.

  • scanner_models lists Middleman model names, at most 9, tried in order. The config has no models, model_roles or additional_models. Before anything launches, each candidate must be known to Middleman, not retired, and have a provider recorded, and you need permission to call it and read its results. A name that routes to another model (a prefixed name like openai/foo) is refused with a 422.
  • Each eval goes to the first candidate that the read policies of all its models allow: every model the eval declared or any of its samples called, and every model its eval set recorded as an input when it launched or resumed (see How the cross-lab rule decides). An eval of public models only goes to the first candidate.
  • List every candidate's provider SDK in packages (anthropic, openai, google-genai for Gemini, ...), as for any scan whose models use package: inspect-ai. Each scan installs your packages; a missing SDK fails each chunk with No module named ... after launch.
  • excluded_evals takes eval set ids or <eval set id>/<file>.eval, and needs scanner_models. An eval set id also leaves out its evals still importing.
  • Evals not successfully imported (still importing, or failed) are left out, and their eval sets are listed.
  • Eval sets you can read but that record a model which is now unknown or inaccessible (one moved to another group since the import, for example) are left out whole. Only their number is reported (forbidden_eval_sets).

One scan per scanner model

Hawk launches one restricted scan per candidate that gets evals, with ids <base>-1, <base>-2 and so on. Each scan has its own model, evals and results, and you resume, delete and follow (hawk logs) each by its own id. hawk scan run prints them:

Launched 1 of 2 scans:
  scan-a-1  claude-haiku-5-5  4 evals, 40 transcripts  (launched)
  scan-a-2  gpt-6-mini  1 eval, 12 transcripts  (failed: Server error: boom)
    resume with: hawk scan resume scan-a-2
3 evals excluded
1 eval set left out (import not finished): set-new
2 eval sets left out (a model they recorded is no longer readable to you)
  • A scan that failed after saving its config says resume with: hawk scan resume <id>. One that failed before saving anything says nothing saved to resume; relaunch the scan: run hawk scan run again, which launches every candidate again, since one scan can't be relaunched alone. The other scans launch either way.
  • The last scan id, which commands like hawk scan resume and hawk logs use when given none, is the first scan that launched or can be resumed. No viewer or Datadog links are printed.
  • hawk scan run exits 0 when every scan launched, 2 when some launched and others failed, and 1 when none launched.

To find the results in the warehouse, match the shared prefix of the ids; scan.model names each scan's scanner model:

SELECT s.job_id, s.model, count(*) AS results
FROM scan s
JOIN scanner_result r ON r.scan_pk = s.pk
WHERE s.job_id LIKE 'scan-a-%'
GROUP BY s.job_id, s.model;

Unscannable evals

If any imported eval you can read can't go to a candidate, nothing launches. The request fails with 422 "Unscannable evals", which lists each eval (or each eval set none of whose evals can be scanned) with the reason and the models it recorded. hawk scan run prints the first five and saves the full list in the current directory as unscannable-<UTC time>.yaml, ready to paste:

# 3 evals can't be scanned. Add a scanner model that may read them, have the missing models recorded in Middleman, or list them in excluded_evals:
# Add a scanner model that may read them, or paste this into your scan config:
excluded_evals:
  - "eval-set-a"  # every eval; no listed scanner model may read it; models: lab-x/model-p
  - "eval-set-b/three.eval"  # its models were never recorded; models: none recorded

Add a candidate that may read them, ask a Middleman administrator to register an unknown model or record a missing provider, or merge the entries into your config's excluded_evals: and launch again. --allow-sensitive-cross-lab-scan is refused. Evals whose models were never recorded (imported before Hawk recorded them), whose log can't be pinned, or whose log isn't in its eval set's folder can only be listed in excluded_evals, unless an operator backfill or a re-import records them.

Resuming a scan

hawk scan resume <base>-<n> resumes one scan with the evals recorded for it at launch, judged again against current permissions and read policies:

  • 403 "Sources changed" when you can no longer read every eval set it recorded (also when one was deleted, or now records a model you can't read). Launch a new scan instead.
  • The scanner model checks above run again.
  • 422 "Unscannable evals" listing recorded evals that were deleted, whose log changed (rewritten or moved), that the scan's model may no longer read, or that are being imported again ("retry once its import finishes"). The resume can't exclude them: retry after the import, or launch a new scan.

Concurrency

Each chunk's model calls are adaptive by default: they back off on rate limits, down to one request at a time, and grow again up to 100. Set max_transcripts to cap a scan's transcripts in flight across all its pods, for example where Middleman's fairness scheduling isn't enabled. Each scan has its own cap. The floor is one transcript per worker pod, so a cap below its worker pod count can't be met.

Limits

  • Scans under --all or a selection, model-free ones included, take no secrets (--secret, --secrets-file, runner.secrets or scanner secrets), accept only HAWK_SCAN_CHUNK_* names in runner.environment, and refuse --allow-sensitive-cross-lab-scan.
  • A scan with a scanner model reads only the .eval logs recorded for it, never sample artifacts.

With a selection

scanner_models works the same way with --transcripts FILE: each scan scans only its share of the selected transcripts. excluded_evals isn't available; remove those transcripts in your query instead. A refusal is saved the same way, as an unscannable: list of the evals whose transcripts to remove. If the selected transcripts are re-imported during the launch, it fails with 409 "Selected transcripts changed"; retry it.

Scan Results

A scanner that reads whole transcripts stores a reference to its input rather than a copy: the result row names the source eval log, the sample uuid and the content the scanner asked for, and its input column is empty. Scanners over messages, events or timelines, and scanners with a custom @loader, still store their input in the row, and local scans copy every input. Resuming a scan started before reference mode was enabled keeps copying inputs for the models whose scan had already started; a model whose scan hadn't started yet stores references.

The scan viewer reads a referenced sample when you open its result, so it shows the input only if you can view the source eval set as well as the scan. Samples larger than 16 MiB uncompressed aren't shown in place; the result says so and links to the sample in the log viewer.

Downloaded scan results contain the references, not the transcripts: for these scanners input is null, and transcript_id is the sample's uuid. To see a result's input, open the result in the scan viewer, or fetch the whole sample with hawk transcript <transcript_id> (add --raw for its JSON).

Resuming Scans

Scan configs are saved to S3. Cluster scan jobs do not automatically retry failed runner pods; resume explicitly after investigating a failure:

hawk scan resume              # resume the last scan
hawk scan resume SCAN_RUN_ID  # resume a specific scan

Resume uses the saved configuration. If configuration or permission files are missing, submit the original configuration again with hawk scan run original.yaml to start a new scan. If the saved scan has no results yet, resume starts it normally.

Scans read their sources through the Hawk API. A scan started on an older Hawk version that already has results can't be resumed, because Scout's saved state names the sources' S3 paths; the resume fails with an error saying so. Submit its configuration again as a new scan.

Secrets must be re-provided via --secret or --secrets-file when resuming. Use --force only for the submission-guard exception described above.

Model credential renewal

Hawk installs its credential hook through Inspect's package discovery, so multiprocessing and resumed scans can renew Inspect model credentials. The model-call retry requirement applies to scanner models and model roles, including dynamically created clients. User-token renewal shares rotating refresh-token state with the runner's AWS helper and requires working local file locking and private cache storage. Each process keeps the credential source selected at startup. Start a new process to change the source; token rotation and operator token overrides still work. Direct provider SDK clients need their own refresh handling.

If a process dies after the identity provider rotates a refresh token but before the replacement is saved, recovery can require an operator token override or a fresh run. Credential renewal does not preserve Scout's local resume buffers across pods.

Running Scans Locally

The first command uses the repository's example file. From the root of a cloned Hawk repository, replace its SAMPLE_UUID_* placeholders and uncomment its sources with the eval set holding them: a local scan can't look eval sets up in the warehouse. Otherwise, pass the path to your own scan config.

hawk local scan hawk/examples/simple.scan.yaml
hawk local scan config.yaml --secrets-file .env --secret MY_API_KEY --priority medium

--priority defaults to low and also works with --direct. It sets the inference priority when requests are routed through Middleman.