Skip to main content
How agent-guardian resolves every setting at scan time. The schema is sourced from src/agent_guardian/config.py; every key documented here is a field on a real Pydantic model with extra="forbid" — typos raise at load time.

When to use a config file

The CLI works out of the box with zero config. Reach for a YAML file when:
  • You’re checking the same project into git and want CI runs to be reproducible without sprawling CLI flags.
  • You have a team-wide default model / budget you want every developer to pick up.
  • You want one project’s settings to live next to its code without polluting ~/.agentguardian/config.yaml.

Precedence (highest wins)

A missing config file is a no-op: the CLI uses defaults so a fresh install works. Missing sections inside a file also fall back to defaults — a half-populated file is fine.

Config file discovery

load_config(path=None) walks this chain:
  1. The explicit path passed via --config PATH.
  2. ./.agentguardian.yaml in the current working directory.
  3. ~/.agentguardian/config.yaml.
First hit wins. Stop the search by setting --config to a real path or by deleting the higher-priority candidates.

Full schema

The Pydantic shape, exactly as the loader enforces it:
Every section has sensible defaults. The shortest valid config file is an empty document:

swarm

LLM identifiers and budget for one scan. The runtime USD cap is a CLI / SDK concern only (--budget-usd or SwarmConfig.usd_cap) — it’s not in the config schema today.

target

Default target shape. The CLI’s four target modes (TARGET positional / --system-prompt / --endpoint / --framework) override this section.

output

Default report shape.
As of 1.0: scan-bundle integrity signing keyed by output.sign_evidence is not yet wired. The flag is accepted for forward compatibility so existing operator configs don’t break on upgrade, but setting it has no effect today — agent-guardian emits a DeprecationWarning on config load if the field is present. What is signed today, unconditionally:
  • Every scan.json ships with Ed25519 + HMAC-SHA256 signatures, verifiable via agent-guardian verify <scan.json>. This happens regardless of the sign_evidence value.
  • Release artifacts (PyPI wheel / sdist, GitHub release tarball) are signed via Sigstore + verified-publisher OIDC in CI.
Bundle-level Sigstore signing — the path the sign_evidence flag was originally intended to gate — is roadmapped for 1.1.0. The flag will gain effect there, or be removed if the implementation lands without needing operator opt-in.

server

Defaults for the serve command.

telemetry

Environment variables

Settings the CLI reads from the environment.

Provider API keys

The CLI accepts both a namespaced key and the provider’s conventional env var. The namespaced key wins. agent-guardian doctor lists which keys it found without sending a request. doctor --check-connectivity issues one tiny validation call per provider.

CLI behaviour

Observability (OpenTelemetry)

Auto-loaded .env

When python-dotenv is installed (it’s in the dev extra), the CLI loads ./.env and ./.env.local from the current working directory at startup. Existing shell exports always win — .env never overrides them. Project-local only: .env files in $HOME or arbitrary ancestor directories are not loaded, to avoid leaking keys between projects.

Runnable example

A complete .agentguardian.yaml for a small team:
Validate it loads cleanly:
Expected output: a Config(...) repr with the values above (and any unset key showing its default). A typo or wrong type raises a Pydantic ValidationError instead.

How to interpret the result

  • Extra keys at any level fail — the loader uses extra="forbid". If you see Extra inputs are not permitted, you’ve got a typo or you’re trying to extend the schema (open an issue).
  • agent-guardian doctor reports the effective config file path: the line config (cwd): <path> (or <not present>) tells you what the CLI sees right now.
  • Provider keys are read at scan time, not load time. Rotating a key doesn’t require restarting the dashboard.

Next step