Skip to content

Python CLI

Use this if you want to run the agent locally or integrate it into a non-GitHub CI system. You'll need a diff JSON file produced by drift-guard-engine first.

Installation

sh
pip install drift-agent

Usage

sh
drift-agent \
  --diff diff.json \
  --org my-org \
  --token $ORG_READ_TOKEN \
  --github-token $ORG_READ_TOKEN \
  --consumer-repos your-org/service-a,your-org/service-b \
  --pr 42

Options

FlagEnv varDescription
--diffPath to drift-guard JSON diff file, or - to read from stdin
--orgGITHUB_ORG / GITHUB_REPOSITORY_OWNERGitHub org owning the consumer repos
--tokenORG_READ_TOKENPAT with repo + read:org scopes for cloning consumer repos
--github-tokenGITHUB_TOKENToken for posting PR comments and opening Issues
--prPR_NUMBERPull request number to link in consumer Issues
--provider-repoGITHUB_REPOSITORYFull name of the provider repo (e.g. org/repo) — excluded from scan
--consumer-reposCONSUMER_REPOSComma-separated list of owner/repo to scan
--modelDRIFT_GUARD_MODELAnthropic model for risk analysis (default: claude-opus-4-6)
--dry-runPrint output without posting to GitHub

Generating a diff

Use drift-guard-engine to produce the JSON diff first:

sh
# OpenAPI
drift-guard openapi --base openapi.base.yaml --head openapi.yaml --format json > diff.json

# GraphQL
drift-guard graphql --base schema.base.graphql --head schema.graphql --format json > diff.json

# gRPC
drift-guard grpc --base api.base.proto --head api.proto --format json > diff.json

Released under the MIT License.