agent-rerun (Python)
Portable reproducibility seed bundle for AI-agent steps. Python port of
@p-vbordei/agent-rerun— passes the same C1–C4 conformance vectors.
A rerun.json v0.1 bundle pins the inputs, sampling parameters, and expected output of one LLM step so any compatible runtime can reproduce it within a declared tolerance. The bundle is one JSON file, JCS-canonical bytes in, Ed25519-signed out.
from agent_rerun import capture, verify, CaptureOptions, generate_key_pair
kp = generate_key_pair()
step = {
"model": {"vendor": "anthropic", "id": "claude-opus-4-7"},
"sampling": {"temperature": 0, "top_p": 1, "seed": 42},
"inputs": {
"system_prompt": "you are a helpful assistant",
"messages": [{"role": "user", "content": "say hi"}],
},
"runtime": {"class": "cloud"},
"expected": {"transcript": {"messages": [{"role": "assistant", "content": "hi"}]}},
"tolerance": {"level": "byte"},
}
bundle = capture(step, CaptureOptions(signing_key=kp.private_key))
actual = {
"inputs": {"system_prompt": step["inputs"]["system_prompt"], "messages": step["inputs"]["messages"]},
"output": {"transcript": step["expected"]["transcript"]},
}
result = verify(bundle, actual)
print("match" if result.verified else result.errors)
Install
pip install agent-rerun
CLI
rerun capture step.json -o bundle.rr [--key key.json]
rerun verify bundle.rr actual.json
Exit 0 on pass, 1 on fail. Result is { "verified", "errors", "warnings" } JSON on stdout.
Why this exists
OpenAI's seed is best-effort. vLLM determinism is runtime-specific. SLSA proves builds, not LLM outputs. There was no vendor-agnostic envelope for an LLM step's inputs, params, and expected output you can sign, share, and verify on a different runtime within a declared tolerance. agent-rerun is that envelope. See the TS reference README for the full landscape.
Conformance
This port is verified against the same fixture set as the TypeScript reference. Each vectors/<name>/ directory carries a bundle.rr (JCS-canonical bytes), an actual.json, and an expected.json. The Python verify() output must match expected.json (verified flag plus every substring in errorContains[] / warningContains[]).
uv sync --extra dev
uv run pytest -v
| Clause | Vector | Behavior |
|---|---|---|
| C1 | c1-byte-replay-passes |
Signed bundle + matching actual + byte tolerance → pass. |
| C2 | c2-semantic-replay-passes |
Signed bundle + cosine ≥ threshold → pass. |
| C3 | c3-mutated-bundle-rejected |
Edited bundle after signing → fail with BadSignature. |
| C4 | c4-messages-mismatch-rejected |
Actual carries different messages → fail with InputHashMismatch. |
Plus seven bonus vectors covering schema strictness, embedding dim mismatch, structural-unsupported, and fingerprint drift.
Where it fits
agent-rerun— TS reference (this port's source of truth).agent-rerun-rs— Rust port (same vectors).agent-scroll-py— canonical transcript hashed intoexpected.transcript_sha256.
License
Apache 2.0 — see LICENSE.
Metadata
Release files for agent-rerun 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 | |
|---|---|---|---|---|
| agent_rerun-0.1.0.tar.gz | 45.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| agent_rerun-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 61.9 kB
Release files / agent_rerun-0.1.0.tar.gz
| Download URL | agent_rerun-0.1.0.tar.gz |
|---|---|
| Size | 45.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
60fcd9e0187fcb4624685cf25964142dfe5394f904d055576c7c4058632c224d
|
|
BLAKE2b-256 checksum How to use checksums |
ce9bc3a309f58271c9086e24d27df4662da30e744ca9879913c4777c1d69d389
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.4
|
Release files / agent_rerun-0.1.0-py3-none-any.whl
| Download URL | agent_rerun-0.1.0-py3-none-any.whl |
|---|---|
| Size | 16.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9166599c709be55da7f2372b3abbe0ed2ba4b8524593e7fb30da56357ac685c8
|
|
BLAKE2b-256 checksum How to use checksums |
0cf262ad3fcf305b172f127ef47ca6f882cd9aea350bfd78e16f7d3395c140a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.4
|
Security for agent-rerun 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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.