Turn real agent runs into safe, small, repeatable tests.
Read a trace export, mask the private data it can detect, keep one example of each distinct behaviour, and write tests that run in CI with faultgate-zero. The offline tests pass on day one with no model calls. The live tests re-run your agent on each real prompt and check it.
What is trace-to-fixture?
trace-to-fixture extracts high-value regression scenarios from telemetry exports. It scrubs private data with deterministic HMAC pseudonyms, keeps one example of each distinct behaviour, and outputs executable pytest fixtures.
Offline fixtures pass immediately in CI without API keys or token spend. Live tests re-run your agent on each real prompt and check it.
Known limit: trace-to-fixture 0.1.0 needs faultgate-zero below 0.2 and fault-contract needs 0.2 or newer, so the two cannot be installed in the same environment yet.
INSTALL & QUICKSTART
pip install trace-to-fixture
pip install 'trace-to-fixture[pii]' # adds Presidio for names and places# 1. Scan export without writing files
trace-to-fixture scan export.otlp.json
# 2. Build fixture set using a secret salt
export T2F_SALT="quickstart-demo-salt"
trace-to-fixture build export.otlp.json --out tests_out --policy policy.json --agent refund_agent:run
# 3. Run offline tests (0 model calls, free)
pytest tests_out01 / COMMANDS
| Command | What it does | Writes |
|---|---|---|
trace-to-fixture scan INPUT | Format, precheck, counts of detected values by kind and by field, dropped attribute keys. | nothing |
trace-to-fixture build INPUT --out DIR | Load, precheck, scrub, prove verdicts are unchanged, group, select, write, leak scan. | DIR |
trace-to-fixture verify DIR | Leak scan of every file, hash checks, loading in faultgate-zero and faultgate, snapshot verdicts. | nothing |
trace-to-fixture explain INPUT --trace ID | One trace: changed fields (path, kind, lengths, never values), raw vs scrubbed verdicts, signature, why kept. | nothing |
trace-to-fixture promote DIR ID | Change a fixture from known_failure to guard. | manifest.json |
EXIT CODES: 0 SUCCESS · 1 PROBLEM FOUND (LEAK, MISMATCH, DRIFT) · 2 USAGE OR INPUT ERROR.
02 / HOW IT WORKS
1. Load: Reads exports via faultgate loaders (OTLP, OpenInference, Langfuse, LangSmith, Braintrust). Precheck issues halt execution early.
2. Scrub: Detected private values become keyed HMAC tokens (<KIND_xxxxxxxx>). The same private value consistently maps to the same placeholder under your secret salt so equality checks work.
3. Prove: Runs checks on each trace before and after scrubbing. Verdicts must match exactly.
4. Select: Groups traces by distinct behavioral signature. Every group where a check fired is kept, and the largest clean groups fill the rest (--max-clean, default 20). Selection is deterministic.
5. Write: Generates standalone fixtures, a manifest, and pytest files.
03 / LIVE REPLAY & PROMOTION
Live tests re-run your agent on each real prompt. To execute them without real customer data, supply non-production placeholders in substitutions.json.
Live tests run only when requested with -m agent_live or T2F_LIVE=1. When a recorded production failure is fixed, the test fails with instructions to run trace-to-fixture promote DIR ID, locking the scenario as a permanent regression guard.
04 / PRIVACY & HONESTY
REQUIRED HONESTY NOTICE
trace-to-fixture masks the private data its detectors can find (secrets, emails, US SSNs, card numbers, IP addresses, phone numbers; names and places with the optional pii extra), plus anything you list in a deny file or as a sensitive key. It is not an anonymisation or compliance product, and detectors miss things such as internal customer ids. Always run scan, read what it found, and review the output before you commit it.
- Raw values live only in memory: never in files, logs, exceptions, or the manifest.
- The salt is a secret. Keep it in a secret store or CI secret, never in git. Use one salt per customer audit.
- substitutions.json holds test data only.
- If a detector misses something, add it to --deny-literals (one literal per line) or --sensitive-key.
05 / LIMITS
- Multi-turn conversations are kept as offline fixtures only (replayable: false).
- Tool responses are not mocked: live replay calls your own tools in your own test environment.
- Input is an export file: there is no vendor API puller.
- Builds on faultgate (0.4.2 or newer) and faultgate-zero (the checks).
- Known limit: trace-to-fixture 0.1.0 needs faultgate-zero below 0.2 and fault-contract needs 0.2 or newer, so the two cannot be installed in the same environment yet.
06 / THE FAULTLINE SUITE
trace-to-fixture
Real agent runs become safe, small, repeatable fixtures.
Current product →fault-contract
Tool-call shape checks for request arguments and response results.
Open product →faultgate
Release gate over recorded traces with noise-aware statistical bands.
Open product →Need help capturing regression fixtures?
FAULTLINE offers fixed-scope diagnostic and production reliability audits. Production audits install and configure these tools when compatible.