agent-build-gates
Quality gates for agent-built code. Three of them, all pure standard library, plus an optional fourth.
When an agent writes code at volume, the failure that costs most is not a bug. It is work that
looks complete and never touched the service it claims to demonstrate: a class that stands in for
a queue, a validator that returns ALLOW because the API was unreachable, a fallback chain whose
models never got called. Asking for honesty does not catch that. A script that fails the build does.
Not on PyPI yet, so install it from source. The release workflow and the packaging metadata are ready; what is outstanding is registering the trusted publishers and pushing the first tag.
pip install "agent-build-gates @ git+https://github.com/snymanpaul/aws_agent_1#subdirectory=packages/agent-build-gates"
Once published this becomes pip install agent-build-gates.
The gates
no-sim-check
Flags substituted integrations: code that fabricates a success for a call it could have made.
no-sim-check $(git ls-files '*.py')
It looks for substitute-object vocabulary (mock, stub, fake, dummy, hardcoded), returns
that fabricate a result, "in production this would" deferrals, and a bare return True straight
out of an except. Two scoping rules keep the signal usable, both learned from classifying every
hit in a 275-file repo:
- Identifier-aware boundaries. A plain
\bstops at underscores and CamelCase humps, soclass MockSQSQueue,mock_clientand_simulate_human_responseare invisible to it while their docstrings trip it. This uses boundaries that break on both. - Prose is exempt. The two vocabulary rules never fire on comments or docstrings, because a comment cannot fake an integration. Only code can. The deferral rule still reads comments, since a deferral comment is the marker for a call that was never made.
Escape a justified line with a trailing # nosim:ok <reason>.
The question the tool cannot answer for you, and the one that separates a real hit from noise: was a real call available and skipped? A helper that genuinely raises to drive a recovery path is fault injection and legitimate. Code that fabricates a success is not.
check-no-aws-ids
Blocks AWS account identifiers from entering tracked .md and .py files: 12-digit account ids,
SSO admin profile strings, sso_account references, and ARNs carrying an account field.
check-no-aws-ids $(git ls-files '*.md' '*.py') # explicit files
check-no-aws-ids # every tracked .md/.py in the current repo
Paths resolve against your working directory, so it behaves the same installed from a wheel or
vendored into a repo. Extend the known-safe literals at the call site rather than editing the
module: scan(files, allow=ALLOW | {"123456789012"}).
Escape a single line with noaws:ok, matched anywhere on it, so it works as # noaws:ok reason
in Python and <!-- noaws:ok reason --> in Markdown. Anything that must legitimately contain
account-shaped strings needs this: this gate's own tests, and documentation like the paragraph
above. The marker covers only its own line, never the rest of the file.
eval_harness
Multi-run evaluation with confidence intervals and significance testing, so a single lucky run cannot be reported as a result.
from agent_build_gates import Case, run_suite, gate, wilson
cases = [Case("input text", expected="positive")]
correct = lambda out, case: 1.0 if case.expected in out.lower() else 0.0
result = run_suite(cases, my_run_fn, {"correct": correct}, n=5)
passed, reasons = gate(result, baseline=previous, min_quality=0.8, metric="correct")
run_fn(input) -> (output, tokens) is yours, so the harness never assumes a framework. gate
combines a quality floor, a cost ceiling and a permutation test against a frozen baseline, and
returns every reason it failed rather than the first. wilson gives the interval on the rate.
ship-gate, behind an extra
ship_gate composes the harness into one auditable GO or NO-GO verdict over real agent runs, and
writes the verdict plus the underlying runs to JSON so the decision can be re-examined. It drives
a framework and it spends money, so it is optional:
pip install 'agent-build-gates[strands]'
Importing agent_build_gates never pulls that in. Import agent_build_gates.ship_gate directly
when you want it; without the extra it raises an ImportError naming the install command.
Testing your gates
These gates are themselves tested, which is the point. A tripwire with no test proving it fires is an unverified claim about the thing that verifies everything else. When this package's own anti-simulation gate was finally given paired positive and negative controls, it turned out to be wrong in both directions at once: it fired on comments describing deliberate fault injection, and it missed the substituted classes it existed to catch. Fixing it took one repo from 133 reported hits to 0 and surfaced nine real substituted integrations that had been invisible.
Measure the precision and recall of your own gates before you trust a green run.
License
MIT.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agent_build_gates-0.1.0.tar.gz.
File metadata
- Download URL: agent_build_gates-0.1.0.tar.gz
- Upload date:
- Size: 23.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.6 {"installer":{"name":"uv","version":"0.12.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98358e7ba47c3ca57c943b9c61ff5053681bf9c813bfac07ba404e8a13ae99d6
|
|
| MD5 |
4221535e509cffeb50894e430816361e
|
|
| BLAKE2b-256 |
51f427399f47e013d9a4d3238ea0ea4d86ddcf134354b626d7b92c8a55c37abb
|
Provenance
The following attestation bundles were made for agent_build_gates-0.1.0.tar.gz:
Publisher:
release.yml on snymanpaul/aws_agent_1
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_build_gates-0.1.0.tar.gz -
Subject digest:
98358e7ba47c3ca57c943b9c61ff5053681bf9c813bfac07ba404e8a13ae99d6 - Sigstore transparency entry: 2613180630
- Sigstore integration time:
-
Permalink:
snymanpaul/aws_agent_1@c6d94b064b13481957d92e32b8ef670c8ee35c91 -
Branch / Tag:
refs/tags/agent-build-gates-v0.1.0 - Owner: https://github.com/snymanpaul
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c6d94b064b13481957d92e32b8ef670c8ee35c91 -
Trigger Event:
push
-
Statement type:
File details
Details for the file agent_build_gates-0.1.0-py3-none-any.whl.
File metadata
- Download URL: agent_build_gates-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.6 {"installer":{"name":"uv","version":"0.12.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
711336ea6e12a938c21d54a5eaedd7ac57bdb9aecbb5249a13bcb5baf72f944c
|
|
| MD5 |
068b84223ba54342d46f50ecc4cabf4f
|
|
| BLAKE2b-256 |
011a233be4928396c240ee05a13d6143f813954f7b917b4db6c83a1a391d612c
|
Provenance
The following attestation bundles were made for agent_build_gates-0.1.0-py3-none-any.whl:
Publisher:
release.yml on snymanpaul/aws_agent_1
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_build_gates-0.1.0-py3-none-any.whl -
Subject digest:
711336ea6e12a938c21d54a5eaedd7ac57bdb9aecbb5249a13bcb5baf72f944c - Sigstore transparency entry: 2613180598
- Sigstore integration time:
-
Permalink:
snymanpaul/aws_agent_1@c6d94b064b13481957d92e32b8ef670c8ee35c91 -
Branch / Tag:
refs/tags/agent-build-gates-v0.1.0 - Owner: https://github.com/snymanpaul
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c6d94b064b13481957d92e32b8ef670c8ee35c91 -
Trigger Event:
push
-
Statement type: