Skip to main content

Local-first decision engine for baseline vs candidate LLM output checks.

Project description

BreakPoint AI

PyPI version Tests License

BreakPoint blocks risky LLM changes before they ship.

Problem: You change a prompt or swap a model. Output looks fine. But cost jumps 38%, a phone number slips in, or the format breaks your parser. You ship it. Users and budgets get hurt.

Who it's for: Teams shipping LLM features to production, merging prompt or model changes via PR, or running cost-sensitive systems.

When to use it: Before every deploy. Gate PRs. Catch regressions before they reach users.

If you don't: Cost drift, PII leaks, and format regressions ship unnoticed. Unit tests won't catch these—LLM output isn't deterministic.


3-Step Mental Model

Step 1: Capture baseline   →  Approved output artifact (store in repo)
Step 2: Generate candidate →  New output from your changed prompt/model
Step 3: Gate in CI         →  breakpoint evaluate baseline.json candidate.json
Baseline  ──→  Candidate  ──→  BreakPoint  ──→  ALLOW / WARN / BLOCK  ──→  CI

Lite Mode (Zero Config)

Out of the box, no config needed:

  • Cost: WARN at +20%, BLOCK at +40%
  • PII: BLOCK on email, phone, credit card (Luhn), SSN
  • Drift: WARN at +35% length delta, BLOCK at +70%, BLOCK on empty output

Exit codes: 0 = ALLOW, 1 = WARN, 2 = BLOCK.

Advanced (config, presets, waivers): --mode fulldocs/user-guide-full-mode.md.


60-Second Quickstart

pip install breakpoint-ai
breakpoint evaluate baseline.json candidate.json

Each JSON needs output (string). Optional: cost_usd, tokens_in, tokens_out, model, latency_ms.

Example BLOCK:

  Final Decision: BLOCK

  • Cost increased by 68.9% ($0.0450 → $0.0760), exceeding 40% block threshold.
  • PII: US phone number pattern detected.

  Exit: 2

Baseline: Treat LLM Output Like a Code Artifact

Baselines are approved snapshots. You commit them. You diff against them. When a change is intentional and you've reviewed it, promote the candidate to baseline:

breakpoint accept baseline.json candidate.json

CI flow: Fails → Human reviews → Accept baseline (or fix) → Merge.


CI Integration

Run the gate directly—no marketplace action required:

breakpoint evaluate baseline.json candidate.json --fail-on warn

--fail-on warn fails CI on WARN or BLOCK. Use --fail-on block to fail only on BLOCK.

Minimal GitHub Actions:

- uses: actions/checkout@v4
- name: Generate candidate
  run: # ... produce candidate.json
- name: BreakPoint Gate
  run: breakpoint evaluate baseline.json candidate.json --fail-on warn

Or use the BreakPoint Evaluate action.


Why Not Just Unit Tests?

Unit tests assume deterministic behavior. LLM output is not. BreakPoint catches what tests miss:

  • Cost drift (same output, higher token bill)
  • Subtle regressions (format change, dropped keys)
  • PII leaks (phone, email, credit card)

Real Story

"We swapped GPT-4 to GPT-4.1. Output looked identical. Cost rose 38%. BreakPoint blocked it before deploy."


Try in 60 Seconds – FastAPI Demo

BreakPoint catching cost regression in FastAPI LLM demo

git clone https://github.com/cholmess/breakpoint-ai
cd breakpoint-ai/examples/fastapi-llm-demo
make install
make good        # PASS
make bad-tokens  # BLOCK

When To Use / When Not

Use: Production LLM features, PR merges, cost-sensitive systems.

Skip: One-off experiments, hobby scripts, non-production.


Why Local-First?

Most tools send prompts and outputs to SaaS. BreakPoint runs on your machine. Artifacts stay in your repo. No network calls for evaluation.


Four Examples

breakpoint evaluate examples/install_worthy/baseline.json examples/install_worthy/candidate_cost_model_swap.json
breakpoint evaluate examples/install_worthy/baseline.json examples/install_worthy/candidate_format_regression.json
breakpoint evaluate examples/install_worthy/baseline.json examples/install_worthy/candidate_pii_verbosity.json
breakpoint evaluate examples/install_worthy/baseline.json examples/install_worthy/candidate_killer_tradeoff.json

Details: docs/install-worthy-examples.md.


CLI

breakpoint evaluate baseline.json candidate.json
breakpoint evaluate payload.json                    # combined {baseline, candidate}
breakpoint accept baseline.json candidate.json     # promote candidate to baseline
breakpoint evaluate ... --verbose                   # full policy output
breakpoint evaluate ... --json --fail-on warn       # CI-friendly

Input Schema

output (string) required. Optional: cost_usd, tokens_in, tokens_out, model, latency_ms. Combined: {"baseline": {...}, "candidate": {...}}.


Pytest Plugin

def test_my_agent(breakpoint):
    response = call_my_llm("Hello")
    breakpoint.assert_stable(response, candidate_metadata={"cost_usd": 0.002})

Update baselines: BREAKPOINT_UPDATE_BASELINES=1 pytest.


Python API

from breakpoint import evaluate

decision = evaluate(
    baseline_output="hello",
    candidate_output="hello there",
    metadata={"baseline_tokens": 100, "candidate_tokens": 140},
)
print(decision.status, decision.reasons)

Troubleshooting

  • ModuleNotFoundError: breakpointpip install breakpoint-ai
  • File not found → Check paths.
  • JSON validation → Ensure output (string) in each object.

Docs

  • docs/user-guide.md
  • docs/user-guide-full-mode.md
  • docs/quickstart-10min.md
  • docs/install-worthy-examples.md
  • docs/baseline-lifecycle.md
  • docs/ci-templates.md

Maintainer

BreakPoint is maintained by Christopher Holmes Silva.

Feedback and real-world usage stories welcome—open an issue or c.holmes.silva@gmail.com.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

breakpoint_ai-0.2.0.tar.gz (43.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

breakpoint_ai-0.2.0-py3-none-any.whl (38.9 kB view details)

Uploaded Python 3

File details

Details for the file breakpoint_ai-0.2.0.tar.gz.

File metadata

  • Download URL: breakpoint_ai-0.2.0.tar.gz
  • Upload date:
  • Size: 43.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.6

File hashes

Hashes for breakpoint_ai-0.2.0.tar.gz
Algorithm Hash digest
SHA256 234cb9ea7b9e314b390a9b16cba8aa9d6f348830dd0511366d7a8f855453b431
MD5 84385065cae0510a7b8feacbb7bea572
BLAKE2b-256 efddb4ccd40ee17a18dec377d91b7931c5d2d2c504b1419801f08bcc39893fe5

See more details on using hashes here.

File details

Details for the file breakpoint_ai-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: breakpoint_ai-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 38.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.6

File hashes

Hashes for breakpoint_ai-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 defa1c38af98c27a8cf6ad86c3e4b591894eafbd88f753e956ba726af458ecfe
MD5 c4c77327fb090c1013468845ea10946a
BLAKE2b-256 5ded51d45c22995977fd1ae6e822c5d99f50d4fd3e688be18243fcaa7d1b4093

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page