GatewayWeave
Offline safety gate for model, prompt, and router changes — replay a candidate on frozen traffic, fail on regressions, and issue a passport your runtime can enforce before load.
GatewayWeave is the policy-and-approval layer for teams that ship LLM components: platform engineers wiring deployment gates, MLOps running pre-release checks without live traffic, and integrators in the Weave family (DeviceWeave, ToolWeave) who need a record-bound allow at load time.
The method follows Raja Tarun, Estimate Before You Deploy: Offline Evaluation as a Safety Gate for Changing Retrieval Routing Policies (Zenodo). See docs/design.md and docs/design/security-notes.md for scoring, routers, and trust boundaries.
Local-first
The default path uses the fixture replay runner and checked-in traffic — no cloud account, no API keys, no network. Optional bedrock replay (pip install gatewayweave[bedrock]) calls Amazon Bedrock when you supply credentials; tests in this repo use stubs and never contact a provider.
Install
Python 3.10+.
python3 -m pip install gatewayweave
Development checkout:
python3 -m pip install -e ".[dev]"
Five-minute quickstart
From the repository root:
bash examples/quickstart.sh
This runs the full gate on synthetic fixtures: a pass (candidate fixes errors with no regressions), a fail (higher accuracy but negative flips), and inconclusive (noise swamps the signal). Output lands in .gatewayweave/quickstart/ (gitignored). Expect exit code 0 and quickstart ok on success.
See examples/README.md for fixture layout and docs/BENCHMARK.md for reproducing the synthetic evaluation harness.
Example 1 — Gate a model change (CLI)
Freeze traffic, replay incumbent and candidate, decide, issue a passport, verify at load time:
OUT=.gatewayweave/demo
mkdir -p "$OUT"
export GATEWAYWEAVE_PASSPORT_KEY=demo-key
INC=anthropic.claude-3-5-sonnet-20240620-v1:0
NEW=anthropic.claude-3-5-sonnet-20241022-v2:0
gatewayweave snapshot --traffic examples/traffic.jsonl --out "$OUT/snapshot.jsonl"
gatewayweave replay --snapshot "$OUT/snapshot.jsonl" --runner fixture \
--fixture examples/pass_incumbent.json --version "$INC" \
--prompt-file examples/prompt.txt --config examples/config.json --out "$OUT/old.jsonl"
gatewayweave replay --snapshot "$OUT/snapshot.jsonl" --runner fixture \
--fixture examples/pass_candidate.json --version "$NEW" \
--prompt-file examples/prompt.txt --config examples/config.json --out "$OUT/new.jsonl"
gatewayweave replay --snapshot "$OUT/snapshot.jsonl" --runner fixture \
--fixture examples/pass_noise.json --version "$INC" \
--prompt-file examples/prompt.txt --config examples/config.json --out "$OUT/noise.jsonl"
gatewayweave compare --snapshot "$OUT/snapshot.jsonl" \
--baseline "$OUT/old.jsonl" --candidate "$OUT/new.jsonl" --noise "$OUT/noise.jsonl" \
--judge exact --out "$OUT/comparison.json"
gatewayweave decide --comparison "$OUT/comparison.json" --out "$OUT/decision.json" --report "$OUT/decision.md"
Use decide's exit code in CI: 0 pass, 1 fail, 2 inconclusive, 3 usage or infrastructure error.
Example 2 — Enforce a passport when loading (Python)
from gatewayweave import ComponentDescriptor, require_passport
descriptor = ComponentDescriptor(
component_kind="model",
component_id="demo-model",
model_version_id="anthropic.claude-3-5-sonnet-20241022-v2:0",
prompt=open("examples/prompt.txt", encoding="utf-8").read(),
config={"temperature": 0},
snapshot_path=".gatewayweave/quickstart/snapshot.jsonl",
passport_path=".gatewayweave/quickstart/passport.json",
)
require_passport(descriptor, now="2026-10-04T00:00:00Z")
After a passing offline run, issue the passport with gatewayweave passport (see examples/quickstart.sh). Set GATEWAYWEAVE_MODE=audit to log denials without blocking; enforce (default) raises PassportDenied when the record does not match.
A runnable script: examples/load_time_check.py.
Example 3 — JSON-field judge on structured outputs
When traffic rows carry structured expected values and model outputs are JSON strings:
gatewayweave compare --snapshot "$OUT/snapshot.jsonl" \
--baseline "$OUT/old.jsonl" --candidate "$OUT/new.jsonl" --noise "$OUT/noise.jsonl" \
--judge json --judge-fields answer,confidence \
--out "$OUT/comparison.json"
Judges are pluggable (exact, json, rule, llm stub). Custom runners and verifiers are documented in docs/EXTENDING.md.
Commands
| Command | Role |
|---|---|
snapshot |
Canonicalize and hash recorded traffic |
replay |
Run incumbent, candidate, or noise replay |
compare |
Score negative flips against noise baseline |
decide |
Pass / fail / inconclusive plus human report |
passport |
Write approval record bound to inputs |
check |
CLI load-time verification |
Routers use component_kind=router, weights in config, and --routed targets — see docs/design.md.
Documentation
| Doc | Contents |
|---|---|
| docs/design.md | Pipeline, scoring, passport binding |
| docs/INTEGRATIONS.md | Ecosystem fit (MCP, Bedrock, CI, OTLP, …) |
| docs/EXTENDING.md | Judges, runners, verifiers |
| CONTRIBUTING.md | Dev setup and PR flow |
| SECURITY.md | Vulnerability reporting |
Tests
python3 -m pytest
Pull requests run the same suite plus examples/quickstart.sh via .github/workflows/ci.yml.
Releasing
.github/workflows/publish.yml publishes to PyPI with trusted publishing (OIDC). Bump pyproject.toml and src/gatewayweave/__init__.py, tag vX.Y.Z, and push the tag. Manual workflow dispatch targets TestPyPI.
Required CI variables, secrets, PyPI trusted-publisher setup, and optional local Bedrock env vars are listed in docs/DEPLOY_CONFIG.md. Copy .env.example for local development placeholders.
License
Apache-2.0 — see LICENSE.
Metadata
Release files for gatewayweave 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gatewayweave-0.1.0.tar.gz | 56.4 kB | With provenance | Details for gatewayweave-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gatewayweave-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for gatewayweave-0.1.0-py3-none-any.whl |
Total release size: 102.4 kB
Release files / gatewayweave-0.1.0.tar.gz
| Download URL | gatewayweave-0.1.0.tar.gz |
|---|---|
| Size | 56.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9b4bf697b6075e96951f854b30dbee106108b8a74337deed663258b2e11763a4
|
|
BLAKE2b-256 checksum How to use checksums |
3082f239150f11df6948588ded5b17071206de79b158f25868443b018d4f70a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 10, 2026.
Transparency logRelease files / gatewayweave-0.1.0-py3-none-any.whl
| Download URL | gatewayweave-0.1.0-py3-none-any.whl |
|---|---|
| Size | 46.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1a07aa664d15d288dac95f7e1f2ae0ce91dbf06eb80a0112cd62d61c91b60e5f
|
|
BLAKE2b-256 checksum How to use checksums |
3f90c313c39d514a44d5d5f8ef70c8879439ed74fed5e0934dfe47563e0a05dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 10, 2026.
Transparency logSecurity for gatewayweave 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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for gatewayweave-0.1.0.tar.gz
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 Nov 10, 2026.
Transparency logA 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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.