Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

giskard-scan

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

Scan entrypoints

quality_scan and vulnerability_scan share the same explicit execution options. Pass shared settings by keyword on either entrypoint; each scan adds scan-specific options (knowledge_base for quality, commercial_use for vulnerability).

from giskard.scan import quality_scan, vulnerability_scan


async def echo(inputs: str) -> str:
    return inputs


vulnerability_result = await vulnerability_scan(
    target=echo,
    description="Customer support chatbot for an e-commerce store.",
    languages=["en"],
    max_scenarios=20,
    seed=42,
    group_by="threat-type",
    parallel=True,
    max_concurrency=8,
    return_exception=False,
    target_mode="multiturn",
    commercial_use=False,
)

quality_result = await quality_scan(
    target=echo,
    description="Customer support chatbot for an e-commerce store.",
    languages=["en"],
    knowledge_base=["Paris is the capital of France."],
    max_scenarios=20,
    seed=42,
    group_by="component",
    parallel=True,
    max_concurrency=8,
    return_exception=False,
    target_mode="multiturn",
)

Shared defaults

DEFAULT_TARGET_MODE ("multiturn") is shared by generate_suite, vulnerability_scan, quality_scan, and third_party_scan. Pass target_mode="singleturn" to skip multi-turn generators/attacks and cap turn budgets to 1.

Discover selectable items for any tool with list_scan_items:

from giskard.scan import list_scan_items

list_scan_items("giskard")  # scenario generator class names
list_scan_items("garak")  # active garak probe names
list_scan_items("deepteam")  # vulnerability + attack names

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 list_scan_items, 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=None -> curated default set; probes="all" -> every active probe
        probes=["probes.goodside.ThreatenJSON"],
        # target_mode defaults to "multiturn"; pass "singleturn" to drop iterative probes
    )
)

print(result)
print(list_scan_items("garak")[:5])

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).

Omitting probes runs a small curated default set aligned with DeepTeam themes (Bias/Toxicity, PII, Misinformation, PromptLeakage, jailbreak/injection, data exfil) — not the full garak catalog. Pass probes="all" for every active probe, or an explicit name list.

Unknown, inactive, or unloadable probe names are logged and emitted as CheckResult.skip scenarios 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
        attacks_per_vulnerability_type=1,  # default; each vuln subtype × this many
        # target_mode defaults to "multiturn" (shared with native Giskard scans)
    )
)

vulnerabilities accepts Bias, Toxicity, PIILeakage, PromptLeakage, and Misinformation. Instantiating those classes without subtypes runs all of their types (for example Bias → race, gender, politics, religion), so cost scales with types × attacks_per_vulnerability_type × attacks.

attacks accepts the single-turn PromptInjection, Roleplay, Leetspeak, and ROT13, plus the multi-turn LinearJailbreaking, CrescendoJailbreaking, TreeJailbreaking, SequentialJailbreak, and BadLikertJudge. Unrecognized names are logged and emitted as skip scenarios (valid names in the same call still run).

target_mode defaults to the shared DEFAULT_TARGET_MODE ("multiturn"). Pass "singleturn" to drop multi-turn attacks (they surface as skip scenarios). Unknown names also skip — the suite is never an empty "everything passed" result when you asked for attacks that could not run.

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.

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.0b4.tar.gz (65.7 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.0b4-py3-none-any.whl (100.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: giskard_scan-1.0.0b4.tar.gz
  • Upload date:
  • Size: 65.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","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.0b4.tar.gz
Algorithm Hash digest
SHA256 2e9b78cab5b725025121e1970cd01cd760aa5279226da26863ffbfca6aa32942
MD5 c4d72d197f59347411d8058d67637d1f
BLAKE2b-256 d7ba2610b3b7c0d0c5dccf7cc569b3ca24a7af0135f10bbc704366a04bf6d483

See more details on using hashes here.

File details

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

File metadata

  • Download URL: giskard_scan-1.0.0b4-py3-none-any.whl
  • Upload date:
  • Size: 100.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","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.0b4-py3-none-any.whl
Algorithm Hash digest
SHA256 45543d08203dd7fb7d5f0300017c5a566ca728b0ba8a9ec7b243a4397de66e52
MD5 49a755e8058f61cc7f9b752e5aa75e81
BLAKE2b-256 7341f31845b5a7790a762bd864b4c9eb458b6ce3451d1e18d9c0405ff90c0d4e

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.0

2 files

This release

1.0.0b4 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page