Portable reproducibility seed bundle for AI-agent steps (Python port of @p-vbordei/agent-rerun)
Project description
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.
Project details
Release history Release notifications | RSS feed
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_rerun-0.1.0.tar.gz.
File metadata
- Download URL: agent_rerun-0.1.0.tar.gz
- Upload date:
- Size: 45.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60fcd9e0187fcb4624685cf25964142dfe5394f904d055576c7c4058632c224d
|
|
| MD5 |
5ceeef98f0eb9e5cf1bef9c3a61cebd2
|
|
| BLAKE2b-256 |
ce9bc3a309f58271c9086e24d27df4662da30e744ca9879913c4777c1d69d389
|
File details
Details for the file agent_rerun-0.1.0-py3-none-any.whl.
File metadata
- Download URL: agent_rerun-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9166599c709be55da7f2372b3abbe0ed2ba4b8524593e7fb30da56357ac685c8
|
|
| MD5 |
75ab6a2e4b9e3c68500d94c3b3161f6b
|
|
| BLAKE2b-256 |
0cf262ad3fcf305b172f127ef47ca6f882cd9aea350bfd78e16f7d3395c140a6
|