Write one rule your backend code must never break. Ayentra automatically finds the exact input that breaks it, shrinks the bug to a 2-line reproduction, and tests the fix in a safe sandbox before you merge.
$ pip install ayentra
Pick a real backend bug scenario below and click Run Check to see how Ayentra finds the exact failing input and tests a safe fix.
Unit tests only check the examples you thought of writing. Ayentra tests thousands of edge cases and thread timings automatically before code reaches production.
Normal tests run one request at a time and pass. In production, two requests arriving together can corrupt balances or double-book tasks. Ayentra tests parallel thread timings to catch races early.
Developers usually test clean positive numbers and normal strings. Ayentra feeds negative amounts, NaN floats, and empty strings, then shrinks any crash down to a 2-line example.
A quick hotfix often solves one crash while breaking another feature. Ayentra tests every suggested code fix inside an isolated sandbox against your full test suite first.
You write the rule once. Ayentra handles the edge-case testing, bug shrinking, and sandbox verification automatically.
Add an @invariant decorator or contract declaration in ayentra.toml stating what must always stay true across your backend.
Ayentra reads backend schema models and type contracts across Python, TypeScript, and Go to generate adversarial boundary cases automatically.
When an input breaks your rule, Ayentra simplifies it down to the smallest 2-line reproduction so you see the exact cause immediately.
Ayentra generates a clean code patch and tests it in a temporary sandbox against both the bug and your existing backend test suite.
Ayentra works alongside Pytest and Mypy by catching edge-case inputs and race conditions they are not designed to test.
| Capability | Standard Pytest | Type Checkers (Mypy) | Ayentra |
|---|---|---|---|
| Checks Business Rules | Manual per test | Type hints only | ✓ Automatic across all inputs |
| Shrinks Bugs to 2 Lines | None | None | ✓ Minimal 1-2 line example |
| Catches Thread Race Conditions | None | None | ✓ Parallel thread testing |
| Generates & Tests Code Fixes | None | None | ✓ Tested in isolated sandbox |
| Reproducible Bug Receipts | None | None | ✓ Saved with exact seed |
Drop Ayentra into GitHub Actions, configure with pyproject.toml, or run it locally in your terminal with one command.
# .github/workflows/ayentra.yml
name: Invariant Verification Gate
on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
verify:
name: Run Invariant Verification
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Runtime Environment
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Ayentra Invariant Gate
uses: Somay-Saini/ayentra-ai@main
with:
target: src/
fix: true
sarif-output: ayentra.sarif
- name: Upload SARIF Report
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: ayentra.sarif
Check rules, view 2-line counterexamples, and test fixes right from your command line.
ayentra check examples/ --seed 42
ayentra apply-patch examples/inventory_ledger.py --yes
Ayentra tests pull requests, posts the exact 2-line failing case in a comment, and generates a verified code fix before anyone clicks merge.
ayentra check --mock-pr-event
git diff HEAD~1 | ayentra check -
Ayentra Invariant Verification Gate FAILED: Method InventoryLedger.reserve violated invariant self.available >= 0 and self.reserved >= 0 and self.available + self.reserved == self.initial_total on input {"units": -1}.
$ ayentra apply-patch examples/inventory_ledger.py --yes
Self-serve monthly plans across Python (live), TypeScript & Go (preview), and Rust (roadmap), backed by Lemon Squeezy Merchant of Record. Cancel anytime.
For individual engineers running local invariant checks and AST guard verification.
$ pip install ayentra
Automated CI invariant verification and property shrinking for growing engineering teams.
Deep concurrency race detection, TOCTOU exploration, and isolated sandbox auto-repair.
Self-hosted runner integration, custom AST templates, unlimited repositories, and dedicated SLA. Inquiries: ayentra.ai@gmail.com.
Lookup your Ayentra subscription balance, monitor remaining monthly CI verification runs, and grab your CI pipeline secrets.
1. Add your key to GitHub Repository Secrets as AYENTRA_API_KEY.
2. Add this step to your .github/workflows/ci.yml pipeline:
# Ayentra Automated CI Invariant Verification
- name: Run Ayentra Verification
env:
AYENTRA_API_KEY: ${{ secrets.AYENTRA_API_KEY }}
run: |
pip install ayentra
ayentra verify --ci --receipt=receipt.json
We tested Ayentra across 7 common architectures spanning financial transfers, rate limiters, thread barriers, and worker queues.
| Pattern | Domain & Target | Plain-English Bug Prevented | Business Risk | Verification |
|---|---|---|---|---|
customer_pilot |
Payment Ledger | Negative balance drift in escrow transfer | Financial balance corruption | VERIFIED |
redis_token_bucket |
Distributed Rate Limiter | Token underflow allows unbounded requests | Rate limiter bypass / DoS | VERIFIED |
scheduler_race |
Thread Task Scheduler | TOCTOU race under multi-thread barrier | Double-allocation / thread leak | VERIFIED |
inventory_ledger |
E-Commerce Inventory | Over-reservation drops total inventory count | Negative stock overdraft | VERIFIED |
celery_task_queue |
Task Pipeline Worker | Unacknowledged retries drop active task count | Pipeline payload loss | VERIFIED |
requests_connection_pool |
HTTP Client Pool | Socket exhaustion on timeout release | Resource exhaustion | VERIFIED |
data_parser |
Sensor Telemetry Stream | NaN and infinite values pass unchecked | Telemetry data corruption | VERIFIED |
Tested on 15 real-world backend targets across data pipelines, payment ledgers, and concurrency schedulers. Every candidate fix is replayed against the bug, checked across hundreds of edge cases, and run through your full test suite in under 3 seconds on average.
decimal_quantize Decimal & precision guard
numeric_clamp Numeric range boundary clamping
non_empty_str String length and validation guard
collection_len Sequence indexing & empty bounds
dict_required_keys Dictionary key existence guard
none_guard Optional / None value guard
uuid_version_check UUID format and version check
bytes_bounds Byte string length and format guard
| # | Target File | Bug Category / Safety Guard | Bug Replay | Edge Case Sweep | Full Test Run | Total Time | Status |
|---|---|---|---|---|---|---|---|
| 1 | customer_pilot.py |
State Invariant / Conservation Law | 8.74 ms | 275.56 ms | 2,488.94 ms | 3,521.99 ms | VERIFIED |
| 2 | data_parser.py |
Input Sanitization & Finite Float | 7.29 ms | 181.01 ms | 2,659.19 ms | 3,113.94 ms | VERIFIED |
| 3 | inventory_ledger.py |
State Invariant / Conservation Law | 7.07 ms | 221.32 ms | 2,455.30 ms | 2,913.62 ms | VERIFIED |
| 4 | scheduler_race.py |
Concurrency / Thread Schedule Race | 211.34 ms | 1,124.14 ms | 2,492.73 ms | 4,355.20 ms | VERIFIED |
| 5 | celery_task_queue.py |
Task Queue Counter Underflow | 7.36 ms | 317.45 ms | 2,270.68 ms | 2,812.31 ms | VERIFIED |
| 6 | redis_token_bucket.py |
Rate Limiter Capacity Boundary | 7.64 ms | 172.47 ms | 2,279.08 ms | 2,574.18 ms | VERIFIED |
| 7 | requests_connection_pool.py |
Connection Pool Active Leaks | 8.07 ms | 15.39 ms | 2,203.35 ms | 2,270.55 ms | VERIFIED |
| 8 | ratio_calc.py |
Zero Division / Modulo Guard | 6.72 ms | 78.86 ms | 2,150.74 ms | 2,284.06 ms | VERIFIED |
| 9 | sequence_reader.py |
collection_len Out-of-Bounds |
22.31 ms | 112.17 ms | 2,157.43 ms | 2,411.51 ms | VERIFIED |
| 10 | mapping_reader.py |
dict_required_keys Missing Key |
23.21 ms | 163.93 ms | 2,195.83 ms | 2,499.42 ms | VERIFIED |
| 11 | profile_loader.py |
none_guard Optional Boundary |
21.81 ms | 98.23 ms | 2,195.37 ms | 2,395.19 ms | VERIFIED |
| 12 | financial_split.py |
decimal_quantize Precision Guard |
21.19 ms | 78.27 ms | 2,290.80 ms | 2,518.85 ms | VERIFIED |
| 13 | timespan_validator.py |
Timezone Date Chronology Guard | 21.33 ms | 105.39 ms | 2,265.51 ms | 2,500.61 ms | VERIFIED |
| 14 | packet_decoder.py |
bytes_bounds (bytes/bytearray) |
24.55 ms | 103.30 ms | 2,180.88 ms | 2,376.83 ms | VERIFIED |
| 15 | session_token_validator.py |
uuid_version_check (uuid.UUID) |
20.49 ms | 107.35 ms | 2,253.54 ms | 2,462.85 ms | VERIFIED |
For zero-trust, air-gapped CI runners and security compliance gates, Ayentra publishes verified SHA-256 package digests. Pin these hashes in requirements files to prevent supply-chain tampering.
# Ayentra Cryptographically Pinned Distribution
ayentra \
--hash=sha256:<release-wheel-sha256> \
--hash=sha256:<release-sdist-sha256>
$ pip install --require-hashes -r requirements-security.txt
Standard CycloneDX 1.5 JSON manifest, verified wheel packages, zero external telemetry, and offline-first execution.
# Ayentra Hash-Pinned Distribution (see docs/sbom_and_provenance_manifest.md)
ayentra \
--hash=sha256:<release-wheel-sha256> \
--hash=sha256:<release-sdist-sha256>
$ sha256sum -c ayentra-release.sha256
$ pip install dist/ayentra-*.whl --no-index --find-links=dist/
Ayentra Studio provides a local interface to inspect bugs, preview code diffs side-by-side, and test fixes with keyboard shortcuts.
$ ayentra studio --port 8420