Skip to main content

AgentCorrect

Stop your AI agents from destroying production.

What This Does

AgentCorrect scans AI agent traces and blocks deployments when it finds:

  • Payment API calls missing idempotency keys (duplicate charges)
  • SQL queries that would delete/modify all records
  • Infrastructure commands that would wipe caches or databases

Exit code 2 fails your CI/CD pipeline. That's it.

Who Needs This

You need this if:

  • Your AI agents call payment APIs (Stripe, PayPal, Square, etc.)
  • Your AI agents execute SQL queries
  • Your AI agents touch Redis, MongoDB, or cloud infrastructure
  • You've ever had an agent accidentally charge a customer twice
  • You've ever had an agent delete production data

You don't need this if:

  • Your agents are read-only
  • Your agents don't touch money or data
  • You manually review every agent action

Installation

pip install agentcorrect

Usage

# Analyze agent trace
agentcorrect analyze trace.jsonl

# In CI/CD pipeline
agentcorrect analyze trace.jsonl || exit 1

What It Catches

Payment Disasters

  • Stripe: Missing Idempotency-Key header → Prevents duplicate charges
  • PayPal: Missing PayPal-Request-Id → Prevents duplicate charges
  • Square: Missing idempotency_key in body → Prevents duplicate charges
  • 25+ payment providers with their exact requirements

SQL Disasters

  • DELETE FROM users WHERE 1=1 → Blocked (tautology)
  • DELETE FROM users → Blocked (no WHERE clause)
  • TRUNCATE TABLE orders → Blocked (data loss)
  • DROP TABLE customers → Blocked (irreversible)

Infrastructure Disasters

  • Redis: FLUSHALL → Blocked (cache wipe)
  • MongoDB: dropDatabase → Blocked (database deletion)
  • S3: DeleteBucket → Blocked (storage deletion)

Real Example

Your agent does this:

# Agent tries to charge customer
response = stripe.charges.create(amount=5000, currency="usd")
# Network timeout, agent retries
response = stripe.charges.create(amount=5000, currency="usd") 
# Customer charged twice - $100 lost

AgentCorrect catches this:

Missing payment idempotency
Provider: Stripe  
Fix: Add header 'Idempotency-Key: <unique-order-id>'
Exit code: 2 (Build Failed)

Trace Format

JSONL format - one JSON object per line:

{"role":"http","meta":{"http":{"method":"POST","url":"https://api.stripe.com/v1/charges","headers":{},"body":{"amount":1000}}}}
{"role":"sql","meta":{"sql":{"query":"DELETE FROM users WHERE id = 123"}}}
{"role":"redis","meta":{"redis":{"command":"GET user:123"}}}

Why This Works

  1. Vendor-specific knowledge: We know Stripe needs Idempotency-Key in headers, Square needs idempotency_key in body. This isn't guesswork.

  2. AST parsing for SQL: We parse SQL structurally, not with regex. No false positives.

  3. Exit codes for CI/CD: Non-zero exit fails the build. Standard CI/CD practice.

CI/CD Integration

GitHub Actions

- name: Test Agent Safety
  run: |
    python run_agent.py > trace.jsonl
    agentcorrect analyze trace.jsonl

GitLab CI

test-agent:
  script:
    - python run_agent.py > trace.jsonl
    - agentcorrect analyze trace.jsonl

Testing

Run the verification suite:

python verify.py        # Test all detections
python ship_tests.py    # 15 acceptance tests
./quick_proof.sh       # 60-second proof

Limitations

  • Only catches what we know about (95% of payment providers, common SQL patterns)
  • Requires trace data in JSONL format
  • Can't prevent disasters if you skip the CI/CD check

License

MIT

Contributing

See CONTRIBUTING.md


Built for teams who learned the hard way that AI agents need guardrails.

Metadata

Release files for agentcorrect 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentcorrect 0.1.0
File Size Uploaded Provenance
agentcorrect-0.1.0.tar.gz 32.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for agentcorrect 0.1.0
File Interpreter ABI Platform
agentcorrect-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 71.0 kB

Release files / agentcorrect-0.1.0.tar.gz

Download URL agentcorrect-0.1.0.tar.gz
Size 32.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c5a4220c0458282e5e1dca38b1d61642d6735281e8e0c9ec912463bbf8a3d5d0
BLAKE2b-256 checksum
How to use checksums
04c92e1863a7e3e537e3fd81d01f98e5b68a15235b81c802ab9b3082d5e9a4ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / agentcorrect-0.1.0-py3-none-any.whl

Download URL agentcorrect-0.1.0-py3-none-any.whl
Size 38.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d48c916f5023253e52562df11fa059b09f20444b54452f96ca66f0f27afe9a3d
BLAKE2b-256 checksum
How to use checksums
d22472652af578fdb0bff01c5af06aa6affab876aeaf1bb059009489e78490f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Security for agentcorrect 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page