PromptDrift
Git-native AI behavior change detection.
Change a prompt. PromptDrift automatically shows what changed in AI behavior, what broke, what improved, and whether the change is safe to merge.
PromptDrift turns your real application traffic and prompt changes into automatic regression coverage with Impact Radius analysis, without requiring manual authoring of dozens of YAML tests.
application / prompt / traffic
↓
discovery
↓
scenario library
↓
baseline behavior
↓
prompt change detected
↓
replay + evaluation
↓
regression analysis
↓
GitHub PR / CLI report
3-Minute Quick Start
pip install promptdrift-ci
promptdrift init
PromptDrift scans your repository context and sets up starter files.
1. Log example interactions from Production
Use the PromptDrift CLI or the built-in async/sync CaptureRecorder SDK to capture your production traffic.
from promptdrift.capture.recorder import CaptureRecorder, CaptureConfig
recorder = CaptureRecorder(CaptureConfig(enabled=True))
# Safely wraps your OpenAI client, capturing representative traffic with a rolling retention cap (default 10,000 interactions).
# Redacts raw outputs and uses deterministic sampling to avoid duplicating identical edge cases.
2. Turn captures into candidate regression scenarios
promptdrift learn
3. Review and promote scenarios to the active suite
promptdrift scenarios
promptdrift suggest cancellation_how_do_i_cancel
promptdrift promote cancellation_how_do_i_cancel
4. Create your baseline
promptdrift baseline
5. Run Git-aware check
promptdrift check
Impact Radius & Behavioral Change Report
When you modify your prompt templates and run promptdrift check:
PromptDrift Impact Report
Behavior changed in 8 / 43 scenarios.
✓ 5 improved
⚪ 35 unchanged
💬 17 changed but valid
✗ 3 regressed
Impact radius: 18.6%
Latency change: +7.2%
Cost change: +11.3%
Affected Categories:
Refunds 5 affected
Cancellation 2 affected
Escalation 1 affected
Regressions:
✗ refund_request
Required policy condition failed: 30 days window missing.
✗ cancellation_001
JSON schema failed: 'order_id' is a required property.
Define Explicit Behavioral Contracts (Advanced Mode)
You can always define explicit behavioral contracts in promptdrift.yaml:
version: 2
project:
name: support-bot
provider:
type: openai
model: gpt-4.1-mini
api_key_env: OPENAI_API_KEY
tests:
- id: refund_request
prompt: prompts/support.txt
variables:
policy: Refunds are available within 30 days.
question: Can I get a refund for my order?
assertions:
- type: contains
value: 30 days
- type: not_contains
value: guaranteed
- type: max_length
value: 600
Built-in Deterministic Assertions
exact_match · contains · not_contains · regex · not_regex · json_valid · json_schema · min_length · max_length · max_tokens · latency_ms · cost_usd
GitHub Action & PR Workflow
name: PromptDrift Check
on:
pull_request:
paths:
- "prompts/**"
- "promptdrift.yaml"
permissions:
contents: read
pull-requests: write
jobs:
promptdrift:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: tanveer-arch/promptdrift/action@main # Change to @v1 upon stable release
with:
config: promptdrift.yaml
comment: 'true'
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
Complete CLI Command Suite
| Command | Description |
|---|---|
promptdrift init |
Zero-config setup detecting Git context and prompts |
promptdrift capture |
Log application interactions into local storage |
promptdrift learn |
Cluster captured interactions into regression candidates |
promptdrift scenarios |
List and inspect the local scenario library |
promptdrift suggest |
Suggest deterministic contracts for discovered scenarios |
promptdrift promote |
Promote candidate scenarios into committed regression tests |
promptdrift check |
Git-aware scenario execution and Impact Radius report |
promptdrift accept |
Accept intentional behavior updates as the new baseline (--changed, --scenario, --accept-regressions) |
promptdrift baselines |
List version-controlled baseline history and previous canonical states |
promptdrift test |
Run behavioral contracts suite (backward compatible) |
promptdrift baseline |
Capture canonical version-controlled baseline |
promptdrift diff |
Compare current behavior against baseline |
promptdrift report |
Generate offline HTML report |
promptdrift purge |
Clear all local capture data |
promptdrift doctor |
Validate config, prerequisites, and privacy status |
promptdrift version |
Print version |
Privacy by Default
- No telemetry, tracking, or cloud accounts
- Prompts are evaluated against the provider you configure
- Captured traffic remains local in SQLite and is excluded from Git by default
- Baseline files store hashes and metrics, never raw user inputs or prompt secrets
- Clean wipe available at any time via
promptdrift purge
License
Released under the MIT License.
Release files for promptdrift-ci 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| promptdrift_ci-0.3.1.tar.gz | 75.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| promptdrift_ci-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 128.5 kB
Release files / promptdrift_ci-0.3.1.tar.gz
| Download URL | promptdrift_ci-0.3.1.tar.gz |
|---|---|
| Size | 75.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c3e6341036586a87bebe2cb6baa2274fe0ea7f4a275fac46307c6b3470ef1c53
|
|
BLAKE2b-256 checksum How to use checksums |
20568f3daae8d3789c2df08859ac7280873c4442cdf036d6838cc890bd2ac16a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.
Transparency logRelease files / promptdrift_ci-0.3.1-py3-none-any.whl
| Download URL | promptdrift_ci-0.3.1-py3-none-any.whl |
|---|---|
| Size | 52.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7d545a6a332213b1260a53935edcd1a2592b4eaab9e6730502a190f5c7d2f44e
|
|
BLAKE2b-256 checksum How to use checksums |
1fb72c32b1bc191e0915710b71dad4f445e03e8428e5023d2b673b1f6396a490
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.
Transparency log