Agent Governance ToolkitAgent Governance Toolkit 4.1.0 · Python 3.10+
Dashboard
0%
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
47 small wins to finish your pathNext lesson →

Linting a policy before it ships

agt lint-policy is the command that reads a YAML policy file and reports the mistakes that would stop it loading, before the policy reaches a running agent.

Last updated: 14 Oct, 2026 · Agent Governance Toolkit 4.1.0

The policy-in-a-file lesson wrote rules as YAML. A policy that fails to load leaves the gate empty, which the fail-open default turns into an open door. Linting on the command line catches that in a pipeline, before it ships.

A policy that lints clean

This is the shop policy from earlier: a version, a name, two rules, and a deny default. Save it as good.yaml.

yaml
version: "1.0"
name: shop-policy
rules:
  - name: allow-status
    condition: {field: action, operator: eq, value: order_status}
    action: allow
    priority: 10
  - name: block-delete
    condition: {field: action, operator: eq, value: delete_account}
    action: deny
    priority: 100
defaults:
  action: deny

agt lint-policy reads the file and reports what it finds.

ExampleA well-formed policy passes the linter
agt lint-policy good.yaml

Catching a malformed policy

This file uses a different, nested shape, the one some tools write. It has no top-level version, name or rules, so it would load as an empty policy. Save it as broken.yaml.

yaml
policies:
  - rules:
      - conditions: ["output contains 'password'"]
        action: block

The linter names each missing field and the line it was expected on.

ExampleThe linter names three missing fields
agt lint-policy broken.yaml

What the linter checks

  • The required top-level fields, version, name and rules, without which the policy loads as empty.
  • The shape of each rule, so a rule that could never match is caught before it ships.
  • It does not run the policy. Linting is a shape check; the test command replays real decisions against it.

lint-policy vs agt test

agt lint-policyagt test
ChecksThe file's shapeThe decisions it makes
NeedsOnly the policy fileA policy and fixtures
CatchesMissing or malformed fieldsA rule that gives the wrong verdict

Where you use lint-policy

  • A pre-commit hook that rejects a policy file with a shape error before it is merged.
  • A CI step on any change to a policy, so a broken file never reaches a deployment.
  • A quick check while writing a policy by hand, to catch a typo in a field name.
Watch out. A clean lint does not mean the policy loads the way you expect. The linter and the loader disagree on some shapes: the linter accepts a rule whose condition is written as a plain string, while the loader rejects it. The policy-formats lesson shows that gap. Follow lint with agt test, which uses the real loader.
Try it yourself
  • Add --strict to the clean lint and see whether any warning is promoted to an error.
  • Remove the name field from good.yaml and re-lint.
  • Write a rule with a misspelled field name and see whether the linter catches it.

You understood something today that you didn't yesterday.