Skip to main content

Agent vulnerability scanner — red teaming, prompt injection, adversarial scenario generation

Project description

giskard-scan

Agent vulnerability scanner — red teaming, prompt injection, adversarial scenario generation.

Third-party scanners (experimental)

third_party_scan runs an external security scanner against a Giskard target and returns a SuiteResult. Two scanners are supported, each shipping as an optional extra: garak and deepteam.

pip install giskard-scan[garak]
pip install giskard-scan[deepteam]

garak

import asyncio

from giskard.scan import third_party_scan


def target(inputs: str) -> str:
    # Your agent / model call. Structured (BaseModel) inputs also work.
    return call_my_agent(inputs)


result = asyncio.run(
    third_party_scan(
        target,
        tool="garak",
        description="A helpful assistant",  # required by the API; garak ignores it
        probes=["probes.goodside.ThreatenJSON"],  # omit to run all active probes
        target_mode="multiturn",  # "singleturn" skips garak's iterative probes
    )
)

print(result)

Probes run in parallel; the target is invoked concurrently, so it must be safe to call from multiple threads (per-conversation state is tracked in the Trace, not on the target).

Unknown probe names are logged and skipped rather than raising.

deepteam

Deepteam generates adversarial attacks with an LLM and judges the responses with an LLM, so it needs a working Giskard default generator (see giskard.checks.get_default_generator()) — there is no keyless mode.

result = asyncio.run(
    third_party_scan(
        target,
        tool="deepteam",
        description="A helpful assistant",  # becomes deepteam's target_purpose
        vulnerabilities=["Bias", "Toxicity"],  # omit for a curated default set
        attacks=["PromptInjection", "LinearJailbreaking"],  # omit for defaults
        target_mode="multiturn",
    )
)

vulnerabilities accepts Bias, Toxicity, PIILeakage, PromptLeakage, and Misinformation.

attacks accepts the single-turn PromptInjection, Roleplay, Leetspeak, and ROT13, plus the multi-turn LinearJailbreaking, CrescendoJailbreaking, TreeJailbreaking, SequentialJailbreak, and BadLikertJudge. An unrecognized name raises ValueError listing the valid ones.

target_mode="singleturn" drops every multi-turn attack from the run. If that leaves nothing to run — for example attacks=["CrescendoJailbreaking"] with target_mode="singleturn" — the scan returns an empty SuiteResult, which reads as "nothing failed" rather than as an error.

API keys and LLM-judge detectors

Some garak detectors need an LLM or a third-party API to score a probe:

  • LLM-judge detectors (garak's judge.*, e.g. refusal detection) normally require their own OpenAI key. Instead, they are automatically backed by Giskard's default generator (giskard.checks.get_default_generator()), so they run with the same credentials as the rest of Giskard — no separate OpenAI key needed.
  • Detectors that need a third-party API key you have not set (for example perspective.*, which needs PERSPECTIVE_API_KEY) are skipped rather than silently dropping the whole probe. Each skipped detector surfaces as a skip result (CheckResult.skip) in the returned SuiteResult, with the missing key named in the message, so the rest of the probe's detectors still run.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

giskard_scan-1.0.0b3.tar.gz (61.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

giskard_scan-1.0.0b3-py3-none-any.whl (93.8 kB view details)

Uploaded Python 3

File details

Details for the file giskard_scan-1.0.0b3.tar.gz.

File metadata

  • Download URL: giskard_scan-1.0.0b3.tar.gz
  • Upload date:
  • Size: 61.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for giskard_scan-1.0.0b3.tar.gz
Algorithm Hash digest
SHA256 01481b8ab1e340bb872e61a4f2ee741b4e27e270640d54433acb60406e894eb3
MD5 21bb0b78d1f2943776707a3646f5c4ea
BLAKE2b-256 3195264070b5051a0f49fedaa3eeaacfda337149e7cbeac60658967801e4a868

See more details on using hashes here.

File details

Details for the file giskard_scan-1.0.0b3-py3-none-any.whl.

File metadata

  • Download URL: giskard_scan-1.0.0b3-py3-none-any.whl
  • Upload date:
  • Size: 93.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for giskard_scan-1.0.0b3-py3-none-any.whl
Algorithm Hash digest
SHA256 38ecd28d91e2f28962b413545b76030db2081ff142aa140dd36f5539a77b0da3
MD5 ae80abeba5984bf95c103d9abda4bd92
BLAKE2b-256 787ae709981cda5867b78c2adc76fb5b44dfdaeb029de05cb7dc54dbb0fdf786

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page