Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.agentguardian.io/llms.txt

Use this file to discover all available pages before exploring further.

The complete agent-guardian command surface. Every flag listed here is sourced from src/agent_guardian/cli.py (Typer decorators) — no documented flag is invented.

Global flags

agent-guardian --version    # print version and exit
agent-guardian --help       # show top-level help
The CLI also auto-loads .env / .env.local from the current working directory (project-local, never $HOME or ancestors) when python-dotenv is installed. Existing shell exports always win over .env values.

Commands

The top-level command set:
agent-guardian COMMAND [ARGS]...

Commands:
  version       Print the installed agent-guardian version and exit.
  doctor        Verify install, available LLM keys, and runtime prerequisites.
  list-agents   Print the eleven specialist agents with their ASI category.
  list-probes   Print the bundled seed-probe corpus (one line per probe).
  badge         Emit an AIVSS badge -- text by default, SVG with --svg.
  last-score    Print the AIVSS of the most recent scan.
  serve         Start the local dashboard at http://<host>:<port>.
  report        Regenerate a report from a stored scan.
  verify        Verify HMAC-SHA256 + Ed25519 signatures on a JSON report.
  publish       Publish a signed scan to the public AgentGuardian leaderboard.
  validate      Run the payload-free pre-flight against a contract.
  init          Author a new target contract, then pre-flight it.
  scan          Run an adversarial swarm scan against a target.
  telemetry     Opt-in usage telemetry (consent + status).
  contract      Work with target contracts (schema export, migration).
  scans         Manage stored scans (list, delete, purge --older-than).

version

Print the installed agent-guardian version and exit.
agent-guardian version
Sample output:
1.0.0

doctor

Verify install, available LLM keys, and runtime prerequisites.
FlagDefaultPurpose
--check-connectivityoffProbe each detected provider with one tiny request to validate the key + reach the endpoint. Costs ~0 tokens per provider.
agent-guardian doctor
Sample output:
agent-guardian 1.0.0
CLI: ok
python: 3.11.13
llm keys detected: openai, gemini (NOT validated -- pass --check-connectivity to probe each provider)
bedrock: aws extra not installed (pip install 'agent-guardian[aws]').
sandbox: importable
pdf engine: none | none -- pip install 'agent-guardian[full]' or 'agent-guardian[pdf-fallback]' to enable --output pdf.
otel: extra not installed (pip install 'agent-guardian[otel]'). Without it the OTel exporter is a no-op.
dashboard port 7474: free
state dir: /Users/you/.agentguardian
config (cwd): <not present>
Run doctor --check-connectivity before a paid scan to confirm your keys actually authenticate against each provider’s API.

list-agents

Print the eleven specialist agents with their ASI category.
agent-guardian list-agents
Output:
Agent                  ASI    Description
------------------------------------------------------------
recon-agent            n/a    Phase 1 fingerprint refinement
goal-hijack-agent      ASI01  Goal Hijack
tool-abuse-agent       ASI02  Tool Misuse
privilege-agent        ASI03  Privilege Abuse
supply-chain-agent     ASI04  Supply Chain
code-exec-agent        ASI05  Code Execution
memory-poison-agent    ASI06  Memory Poisoning
a2a-agent              ASI07  Agent-to-Agent (A2A)
cascade-agent          ASI08  Cascading Failures
trust-exploit-agent    ASI09  Trust Exploitation
drift-agent            ASI10  Rogue Agents (drift)

list-probes

Print the bundled seed-probe corpus (one line per probe).
FlagDefaultPurpose
--asi CATEGORYunsetFilter by ASI category (e.g. ASI01).
agent-guardian list-probes --asi ASI02
Sample output:
Probe corpus version: 2026.05
Found 8 probes (filtered by ASI02):
  ASI02-TA-001  [ASI02/critical/T1]  tool-arg-injection
  ASI02-TA-002  [ASI02/critical/T1]  chain-exfil
  ASI02-TA-003  [ASI02/critical/T1]  scope-expansion
  ASI02-TA-004  [ASI02/critical/T1]  parameter-smuggle
  ASI02-TA-005  [ASI02/critical/T1]  recursion-bomb
  ASI02-TA-006  [ASI02/critical/T1]  dns-exfil-via-approved-tool
  ASI02-TA-007  [ASI02/high/T1]      tool-name-typosquat
  ASI02-TA-008  [ASI02/critical/T1]  edr-bypass-via-legit-chain
Each line carries the probe ID, ASI category, severity, tier floor, and the probe’s short name.

badge

Emit an AIVSS badge — text by default, SVG with --svg.
ArgumentTypePurpose
SCOREint (0–100)AIVSS score to render.
FlagDefaultPurpose
--svgoffEmit an SVG badge instead of one-line text.
agent-guardian badge 87
# AIVSS 87 (GOOD) #22c55e

agent-guardian badge 87 --svg > badge.svg
Compose with last-score for README badges:
agent-guardian badge $(agent-guardian last-score --score-only) --svg > badge.svg

last-score

Print the AIVSS of the most recent scan (read from ~/.agentguardian/state.json).
FlagDefaultPurpose
--score-onlyoffEmit only the integer score. Exits 1 when no scans are on record so the outer pipeline fails loudly.
agent-guardian last-score
# AIVSS 87 (GOOD)

agent-guardian last-score --score-only
# 87

serve

Start the local dashboard at http://<host>:<port>.
FlagDefaultPurpose
--host HOST127.0.0.1Bind host. Loopback by default.
--port PORT7474Bind port.
--reloadoffAuto-reload on code changes (dev only).
--token TOKENenv: AGENT_GUARDIAN_DASHBOARD_TOKENDashboard auth token; required for non-loopback binds unless --insecure-no-auth is passed.
--insecure-no-authoffAllow off-loopback bind WITHOUT a token. Exposes scan history to anyone who can reach the port.
agent-guardian serve                          # loopback, no auth needed
agent-guardian serve --host 0.0.0.0 --token $SECRET   # exposed, token-gated
Binding to a non-loopback address without --token or --insecure-no-auth is refused with EXIT_CONFIG (2) so a misconfigured deploy can’t silently expose findings.

report

Regenerate a report from a stored scan.
ArgumentTypePurpose
SCAN_IDstrScan ID to regenerate reports for.
FlagDefaultPurpose
--output FORMATjsonReport format: json | sarif | junit | md | pdf.
--output-path PATHunsetWrite the report to this file. Required for --output pdf (binary).
agent-guardian report cli-3a4c1d9c2840 --output sarif > scan.sarif
agent-guardian report cli-3a4c1d9c2840 --output pdf --output-path scan.pdf
Text formats (json / sarif / junit / md) print to stdout by default, or to --output-path when given. PDF is binary and always requires --output-path.

verify

Verify HMAC-SHA256 + Ed25519 signatures on a JSON report.
ArgumentTypePurpose
PATHpathPath to a signed JSON report.
FlagDefaultPurpose
--pubkey KEYunsetPinned Ed25519 signer public key (base32, no padding).
--pubkey-file PATHunsetRead the pinned Ed25519 public key from this file.
--secret SECRETenv: AGENT_GUARDIAN_SIGNING_SECRETExpected HMAC signing secret. The public default secret is never accepted on verify.
agent-guardian verify report.json --pubkey-file ./team.pub --secret $HMAC
Verification fails closed: a signature alone proves only that the bytes were not tampered (integrity), not who signed them. To report a green (OK) result you must supply a trust anchor. Without an anchor the report is shown as UNANCHORED and the command exits non-zero (EXIT_FAIL_UNDER, 1).

publish

Publish a signed scan to the public AgentGuardian leaderboard.
ArgumentTypePurpose
SCAN_IDstr / pathScan ID under ~/.agentguardian/scans/ or path to a signed scan.json.
FlagDefaultPurpose
--output PATHunsetWhere to write the redacted payload. Default: alongside the scan.
agent-guardian publish cli-3a4c1d9c2840
Today this writes a redacted, leaderboard-ready payload alongside the scan and prints operator-facing instructions for hand submission via the project’s GitHub issue tracker. Refuses to publish unsigned or tampered scans.

scan

Run an adversarial swarm scan against a target. The big one — every flag is documented below.

Target selection (exactly one required)

Argument / flagMode
TARGET (positional, dotted path)Python callable target (my_agent:run).
--system-prompt PATHPrompt-only target (PromptAdapter wraps it around --model).
--endpoint URLHosted HTTP target.
--framework KIND + --framework-ref MODULE:ATTRFramework-native target (LangGraph / CrewAI / AutoGen / OpenAI Agents / ADK / Strands).
--contract PATHDrive the scan from a target contract YAML. Supplies transport, auth, session, and Rules of Engagement.
--framework KIND accepts: adk, autogen, crewai, langgraph, openai_agents, strands.

LLM model wiring

FlagDefaultPurpose
--model SPECstubDefault LLM for all three roles. See Python SDK → build_llm for the spec grammar.
--commander-model SPECunsetOverride commander LLM.
--attacker-model SPECunsetOverride attacker LLM.
--evaluator-model SPECunsetOverride evaluator LLM.
Model specs: stub, openai:gpt-4o, anthropic:claude-haiku-4-5, gemini:gemini-2.5-flash, ollama:llama3.1, bedrock:us.anthropic.claude-haiku-4-5-v1:0.

Scan shape

FlagDefaultPurpose
--mode MODE, -m MODEfullThoroughness: full (every probe, ~5min), smart (early-stop when AIVSS variance stabilises, ~2min), fast (3 probes / 4 turns per agent, ~45s).
--tier Tauto-detectedForce tier: T1, T2, T3, T4.
--seed N0RNG seed for determinism.
--goal TEXTunsetOperator’s natural-language attack goal. When set, the Commander LLM decomposes it into per-agent briefs.
--no-owasp-llmoff (specialists DO run)Suppress the OWASP-LLM specialist agents (fuzzing, secret-extraction, denial-of-wallet, detection-evasion).
--pretextoffWrap attacker payloads in a rotating legitimate-operations pretext (auditor / compliance / incident / onboarding).
--indirectoffDeliver attacker payloads embedded in trusted-channel content (retrieved doc / tool output / email / memory / a2a).
--pov-gateoffRe-run each finding’s trigger N times and drop the unreproducible ones before scoring.
--criticoffWith --pov-gate, also score PoV-passing findings on an LLM rubric and drop low-quality / high-FP-risk ones.
--bundle DIRunsetWrite a checksummed SARIF+PoV bundle to this directory.

Budget + gating

FlagDefaultPurpose
--budget-usd NunsetRuntime USD cap (metered against actual spend). Soft-stops new attack turns at 80% and reserves the rest for the report.
--fail-under NunsetExit 1 if final AIVSS < N.

Output + reports

FlagDefaultPurpose
--output FORMATjsonReport format: json | sarif | junit | md | pdf.
--output-path PATHunsetWhere to write the report file.
--no-tuioffDisable the Rich progress panel.
--config PATHauto-discoveredOverride the default config file location.

Network + reachability

FlagDefaultPurpose
--no-preflightoffSkip the pre-scan reachability check for --endpoint mode. The default preflight protects against burning LLM budget on an unreachable target.

Observability

FlagDefaultPurpose
--otel-endpoint URLenv: OTEL_EXPORTER_OTLP_ENDPOINTOTLP-HTTP endpoint to export OpenTelemetry GenAI spans to (e.g. http://localhost:4318/v1/traces). Contract observability.otel_endpoint wins when both are set.

Debug stream

FlagDefaultPurpose
--debugoffStream per-agent reflections (prompt + response + verdict). Count-style: --debug for truncated panels, --debug --debug to disable truncation.
--debug-formattexttext (Rich panels) or json (NDJSON, one record per line). json implicitly disables the Live region.

Dashboard URL emission + auto-serve

FlagDefaultPurpose
--publish / --no-publish--publishEmit the live-dashboard URL at scan start. --no-publish suppresses for sensitive scans.
--no-serveoffDisable the auto-spawn dashboard server. Equivalent to AGENT_GUARDIAN_DISABLE_AUTO_SERVE=1.
--serve-grace-seconds N300Keep the auto-spawned dashboard alive for N seconds after completion. 0 = shut down immediately. -1 = keep alive until Ctrl-C.

Minimal example

agent-guardian scan --system-prompt prompt.txt --mode fast --model stub
Outputs (truncated):
▸ Scan cli-3a4c1d9c2840 — track live at  http://127.0.0.1:7474/scans/cli-3a4c1d9c2840
▸ Report when complete                http://127.0.0.1:7474/scans/cli-3a4c1d9c2840/report
no budget cap (running to completion)
... (Rich progress panel) ...
AIVSS 87 (GOOD)
The two URL lines land in the first two lines of stdout (QA-003) so CI jobs can grep for them. When stdout is a TTY, the URLs are wrapped in an OSC 8 hyperlink escape so Warp / iTerm2 / Terminal.app / VS Code render them cmd-clickable.

Sub-apps

telemetry

Opt-in usage telemetry. Disabled by default.
Sub-commandEffect
telemetry essentialOperational counts only (the post-prompt default) — agents fired, attempts, successes, threats, AIVSS, duration, crash status, install_id. Does not send adapter / Python / OS / arch.
telemetry extendedEssential + environment fingerprint (adapter, Python version, OS family, CPU arch). Powers the community compatibility matrix.
telemetry enableLegacy alias for telemetry extended (v1.0rc1 compat).
telemetry disableDisable telemetry. Emits a forget event so the collector drops your install_id.
telemetry statusShow the current telemetry tier + local buffer depth.
telemetry resetClear consent + delete install_id + purge pending events. The opt-in prompt re-fires on next interactive scan.
telemetry showPrint the full list of fields telemetry would send if enabled.
agent-guardian telemetry status
agent-guardian telemetry disable

contract

Work with target contracts.
Sub-commandArgs / flagsPurpose
contract schema --out PATH--out (required)Write the contract JSON Schema to a file.
contract migrate FILE--write to overwrite (else print to stdout)Migrate a contract toward the current schema version.
agent-guardian contract schema --out contract-schema.json
agent-guardian contract migrate agentguardian.yaml --write

scans

Manage stored scans (list, delete, purge --older-than). Scans live under $AGENT_GUARDIAN_HOME/scans (default ~/.agentguardian/scans).
Sub-commandArgs / flagsPurpose
scans listList stored scans (id + mtime), most recent first.
scans delete SCAN_IDSCAN_ID (required)Delete a single stored scan directory. Rejects path-traversal and out-of-root targets.
scans purge --older-than SPEC--older-than (required, e.g. 30d, 2w, 6m), --dry-runPurge stored scans older than the threshold.
agent-guardian scans list
agent-guardian scans purge --older-than 30d --dry-run
agent-guardian scans purge --older-than 30d

validate

Run the payload-free pre-flight against a contract (Stage 1B).
ArgumentDefaultPurpose
CONTRACTagentguardian.yamlPath to the contract YAML to validate.
FlagDefaultPurpose
--jsonoffEmit the pre-flight report as JSON instead of text.
--stage NAMEunsetOnly print this single stage’s result.
Walks the seven non-adversarial stages (resolve, connect, probe, round-trip, session, capability, RoE) and stops at the first failure. Exits with the failing stage’s exit code.
agent-guardian validate agentguardian.yaml
agent-guardian validate agentguardian.yaml --json

init

Author a new target contract, then pre-flight it.
FlagDefaultPurpose
--out PATHagentguardian.yamlWhere to write the new contract.
--yes, -yoffNon-interactive: write a minimal valid contract from defaults/flags.
--from-openapi PATHunsetPre-fill the transport / request / response from an OpenAPI 3.1 spec.
--openapi-path PATHunsetWith --from-openapi: the spec path to derive shapes from.
--openapi-method METHODpostWith --from-openapi --openapi-path: HTTP method.
agent-guardian init --yes                       # scaffold a placeholder contract for CI
agent-guardian init --from-openapi openapi.yaml --openapi-path /v1/chat

Exit codes

Defined in src/agent_guardian/cli.py:
CodeConstantMeaning
0EXIT_OKSuccess.
1EXIT_FAIL_UNDERFinal AIVSS fell below --fail-under, or verify failed / last-score --score-only had no scans on record.
2EXIT_CONFIGConfiguration error (bad flag, missing file, unknown format, refused unsafe bind).
3EXIT_TARGET_UNREACHABLEEndpoint preflight could not reach the target.
4EXIT_LLM_PROVIDERLLM provider misconfigured (missing key, unknown provider) or model not found.
5EXIT_SANDBOXSandbox violation — agent attempted a blocked operation.
130EXIT_USER_INTERRUPTOperator hit Ctrl-C.
CI gates should branch on the exit code rather than parsing stdout. The --fail-under N flag turns “scan finished but below N” into a non-zero exit so the job fails the build.

State + config locations

PathPurpose
~/.agentguardian/State dir (override with AGENT_GUARDIAN_HOME).
~/.agentguardian/state.jsonFirst-run ethical banner ACK + last_score.
~/.agentguardian/scans/Per-scan output directories.
~/.agentguardian/config.yamlUser-level config (lowest precedence after defaults).
./.agentguardian.yamlProject-level config (overrides user-level).
./.env, ./.env.localProject-local env vars (only with python-dotenv installed).
See Configuration for the full schema and precedence rules. See Error codes for the LLM exception taxonomy.