A release gate for AI agents that knows noise from regression.
One dependency, reads the traces your agent already records (OTLP, Langfuse, LangSmith, Braintrust, Phoenix), returns PASS / FAIL / INCONCLUSIVE in CI.
What is faultgate?
faultgate is an open-source release gate for AI agents. It reads recorded agent traces, checks structural failures and business policy violations, then compares a candidate against repeated baseline runs. In CI it returns PASS, FAIL, or INCONCLUSIVE, so a team can distinguish a measured regression from normal run-to-run variation.
Use it when a model, prompt, or tool change needs a release decision. It accepts OTLP and exports from Langfuse, LangSmith, Braintrust, and Phoenix. The default checks run locally without a model; optional judges are available. Install with pip install faultgate, then see the quickstart or source repository.
Version 0.5.0 adds faultgate compare: give it repeated baseline and candidate runs and it returns SHIP, REVIEW, or BLOCK across correctness, consistency, approach, cost, speed, and safety; check and the other commands are unchanged. Version 0.4.2 updates the library API for private value spans (used by trace-to-fixture); CLI behaviour and release gate checks are unchanged. Version 0.4.1 updated package identity and links. Version 0.4.0 added policy checks for successful and current prerequisite calls, required arguments, explicit confirmation, complete runs, and optional outcomes from your evaluator. The changelog explains the changes; the 0.3.1 notes below remain as release history.
INSTALL
pip install faultgate
pip install 'faultgate[laya]' # local judge: downloads Laya once (~800 MB, Apache-2.0, pinned revision), offline after
pip install 'faultgate[api]' # any API model through litellm
pip install 'faultgate[pii]' # Microsoft Presidio for --redact presidio (names, locations; MIT)01 / WHAT'S NEW IN 0.5.0
faultgate compare for model and prompt migrations; check and the gate are unchanged.Compare two sets of runs
Pass at least two baseline and two candidate runs. faultgate applies the same checks to both sides and labels six dimensions BETTER, SAME, WORSE, or INCONCLUSIVE: correctness, consistency (pass^k), approach, cost, speed, and safety.
faultgate compare --baseline B1 B2 --candidate C1 C2Paired bootstrap with a Bonferroni-corrected interval; no LLM judge required.
SHIP, REVIEW, or BLOCK
BLOCK on a policy violation or a gated dimension that got worse (exit 1). REVIEW when nothing got worse but a gated dimension is inconclusive (exit 0, or 1 with --strict). SHIP otherwise.
faultgate compare ... --budget budget.json --prices prices.jsonPrices let a model migration be compared in money, not just tokens.
Reproducible reports and CI
JSON output is byte-identical for the same inputs and seed. --markdown writes a PR comment with the reproduce command, and --audit saves the verdict, failing traces, and input hashes. The GitHub Action runs compare mode when given baseline and candidate.
faultgate compare ... --markdown --audit audit/Compare mode in the Action needs faultgate 0.5.0 or newer.
WHAT'S NEW IN 0.4.0 – 0.4.2
State-aware prerequisites
Require an earlier tool call to succeed, check typed fields in its JSON result, and reject stale lookups after later changes.
requires[].success · result · latest · invalidated_byPolicy checks are opt-in and fail closed when a required result cannot be verified.
Required arguments and confirmation
Block mutations missing required values or a prior confirmation, and treat an incomplete run as a policy violation.
required_args · confirmation · require_completeCloses six policy gaps found in an outside retail test.
Your evaluator outcomes
Pass per-scenario results from your own evaluator into the same baseline and gate workflow. Reports show outcome rate separately from structural clean rate.
faultgate check traces.json --outcomes outcomes.json --band band.jsonThe outcomes input is optional; existing commands keep their previous behavior.
WHAT'S NEW IN 0.3.1
Redaction boundary fix
Cards next to digits now masked as Luhn-valid windows. SSNs masked first, and cards at the end of a sentence are masked too.
4111 1111 1111 1111 123-45-6789 -> <CREDIT_CARD> <US_SSN>
Charge card 4111 1111 1111 1111. -> Charge card <CREDIT_CARD>.Found in the first outside test (tau2-bench retail, 180 real runs).
Tool spans without operation name
Tool spans named execute_tool or execute_tool <tool> without gen_ai.operation.name are read as tool steps instead of zero steps.
execute_tool <tool> read as tool step
precheck warns: recognized by name onlyprecheck tool steps + warnings
precheck reports tool steps read, and warns on name-only tool spans, unread tool attributes, and mixed exports.
precheck: OK · format langfuse · checked 1 of 1 traces · 2 tool steps read · 0 error(s), 0 warning(s)Auto-detect mixed exports
Exports with native execute_tool spans and OpenInference LLM spans no longer count tool calls twice.
Native execute_tool spans become steps; native root keeps agent nameOutput file errors exit 2
Output files that cannot be written exit 2 instead of crashing with 1 (which CI reads as gate FAIL).
Exit 2: bad input, or unwriteable output file (--json, --markdown, --audit, --out)Parent directories created automatically.
GitHub Action version input
Action input version: 0.3.1 now correctly installs that version instead of passing it to pip as package name.
with:
version: 0.3.1 # installs faultgate==0.3.1
# supports specifiers, v-prefixes, or git urlsabstention narrowed
No longer fires on a bare "cannot" or "unable to". Inability must be about finding the information.
21 -> 1 false fires on 180 retail runs
P4 calibration unchanged (1/1, 0 FP on 200)Order-level policy rules
requires[].after list, same_arg (prerequisite order match), max_calls_per_arg, and values allowlists.
{
"requires": [{"tool": "cancel_pending_order", "after": "get_order_details", "same_arg": "order_id"}],
"max_calls_per_arg": [{"tools": ["modify_pending_order_items"], "arg": "order_id", "max": 1}]
}0 fires on 120 baseline retail runs, 5/30 on weaker model, 1/30 sabotaged.
WHAT'S NEW IN 0.3.0
Business rules
Define numeric limits, authenticated identity, and tool prerequisite orders in policy.json.
{
"limits": [{"tool": "issue_refund", "arg": "amount", "min": 0, "max": 500}],
"identity": {"arg": "customer_id", "session_attr": "enduser.id", "tools": ["issue_refund", "modify_billing_record"]},
"requires": [{"tool": "modify_billing_record", "after": "verify_customer_identity", "result_contains": "VERIFIED"}]
}Hard block
With --band, any policy violation fails the gate regardless of clean rate, naming the offending step and values.
step 4: modify_billing_record.customer_id 'C-999' != session enduser.id 'C-123'INCONCLUSIVE + sample size
Between PASS and FAIL thresholds, runs a one-sided significance test and sizes the needed scenarios at power 0.80.
gate: INCONCLUSIVE · clean rate 0.93 vs band [1.00, 1.00] from 2 baseline runs · fail below 0.90 · p=0.072
inconclusive: a drop of 0.07 needs 89 scenarios to tell from noise (alpha 0.05, power 0.80) · run 59 moreTwo failures injected into a clean baseline run; tests/test_band.py.
Reads your existing traces
Automatically maps vendor exports from Langfuse, LangSmith, Braintrust, and Phoenix onto the GenAI span model.
--format otlp: OTLP/JSON, GenAI semantic conventions
--format openinference: Arize Phoenix spans
--format langfuse: trace objects with observations
--format langsmith: run list with tool errors
--format braintrust: logged spans with type: toolprecheck
Validates export integrity, span IDs, parent linkages, and timestamps before gating.
precheck: OK · format langfuse · checked 1 of 1 traces · 0 error(s), 0 warning(s)Redaction
Masks PII and credentials in API judge prompts, terminal reasons, CI comments, and JSON reports using stdlib regex.
step 2: update_profile.email '<EMAIL>' != session enduser.id '<EMAIL>'81 emails, 39 phone numbers, 69 JWTs found in 30 real benchmark traces.
PR comment + audit pack
Upserts one in-place PR comment and packages a verifiable audit artifact without copying trace payloads.
--markdown PATH: verdict, gate numbers, fired checks, failing traces, repro command
--audit DIR: verdict.json (with input SHA-256s), failing_traces.json, repro.shcontext_overflow
Detects when a run hit the model context window or provider output token limit (0 FP on 125 real traces).
gen_ai.response.finish_reasons: length / max_tokens or provider context limit error02 / HOW THE GATE DECIDES
Agents are not deterministic. Between the PASS and FAIL thresholds, faultgate tests whether the drop is statistically significant against the baseline mean. The variance accounts for binomial sampling noise and measured run-to-run spread:
| Verdict | Rule (n = scenarios in the band) | Exit |
|---|---|---|
| PASS | clean rate ≥ min observed − 1/n | 0 |
| FAIL | clean rate < min observed − 3/n, or below PASS and the drop is significant (one-sided, α = 0.05) | 1 |
| INCONCLUSIVE | in between and not significant: the gate says how many scenarios it would need (power 0.80) · run N more | 0 |
A policy violation is a hard block. With --band, a run whose clean rate sits inside the measured band still FAILs if the policy check fired on any trace (exit 1); the gate reports policy violation in N trace(s) (hard block). Noise explains a flaky answer, not an unauthorized tool call or parameter breach.
$ faultgate check examples/gate/candidate_gpt.json --band band.json
18/30 traces failed · search_loop=18, abstention=0, policy=0, repeated_call=0, unrecovered_tool_error=0, context_overflow=0 · judge none · 0.0s
gate: FAIL · clean rate 0.40 vs band [0.93, 0.93] from 2 baseline runs · fail below 0.83 · p=0.000
regressions (clean in every baseline, not now): r-0208, r-0214, r-0216, r-0224, r-0226, r-0232, r-0258, ...
$ faultgate check examples/gate/baseline_glm_run2.json --band band.json
gate: PASS · clean rate 0.93 vs band [0.93, 0.93] from 2 baseline runs · fail below 0.83 · p=0.500Real runs: two z-ai/glm-5.3-flash baselines and openai/gpt-5.6-luna on 30 multi-hop scenarios. Regressions clean in every baseline and broken now are named explicitly.
Read Regression or noise? A release gate that measures first for the reasoning behind baseline bands and the current PASS, FAIL, and INCONCLUSIVE verdicts.
03 / WHAT IT CHECKS
| Check | Kind | Fires when |
|---|---|---|
search_loop | rule | The run ended with no answer at its step budget and most tool calls returned nothing. |
abstention | rule | The final answer explicitly says the information could not be found: an inability to find (couldn't find / locate / retrieve / determine), no matching documents, information not available, don't know. A bare cannot / unable to does not count: a support agent that "cannot modify the order again" or is "unable to verify" an unauthenticated caller has not abstained. |
policy | rule | A tool call broke the policy: unlisted tool, denied argument pattern, oversized argument, call budget, argument limit, identity mismatch, or missing prerequisite. |
repeated_call | rule | The same tool was called with identical arguments and returned identical results >= 3 times. |
unrecovered_tool_error | rule | A tool call produced a structural error with no later successful call of the same tool, or a span errored (error.type or status code 2) and no later span made a successful tool call. |
context_overflow | rule | The run hit the model's context window or output token limit: a span's gen_ai.response.finish_reasons says length / max_tokens, or a provider error naming the context limit (context_length_exceeded, "maximum context length", "prompt is too long") in a span status, error.type, tool result or faultgate.termination. |
wrong_answer | golden | Answered, and the expected answer is not in the final answer. |
truncation | golden | The answer has the head of the expected token but not the whole token (Onyx for Onyx-4413). |
wrong_direction | judge | On a multi-hop task, the agent walked the dependency chain backwards. |
A rule is plain code over trace structure: instant, deterministic, no model. A golden check is a rule requiring expected answers (--golden golden.json). A judge check is an opt-in question scored by a local model or API judge.
04 / BUSINESS RULES
Pass --policy policy.json to enforce business constraints on what the agent did, not just which tool names it touched:
{
"limits": [{"tool": "issue_refund", "arg": "amount", "min": 0, "max": 500}],
"identity": {"arg": "customer_id", "session_attr": "enduser.id", "tools": ["issue_refund", "modify_billing_record"]},
"requires": [{"tool": "modify_billing_record", "after": "verify_customer_identity", "result_contains": "VERIFIED"}]
}limits: Numeric floor or ceiling on a tool argument (dotted paths likerefund.amount). Strings like"$1,200.50"are parsed as numbers. Non-numeric or non-object values violate; absent arguments pass.identity: Argument must match the authenticated principal from root span attributesession_attr(defaultenduser.id). Unverifiable calls without this attribute fail closed.requires: Tool may only execute after an earlier call toafter, optionally requiring its returned payload to contain specified text (result_contains).
See a full customer-support policy file in examples/policy_support.json →.
Order-level rules bind a call to the record it acts on:
{
"requires": [{"tool": "get_user_details", "after": ["find_user_id_by_email", "find_user_id_by_name_zip"]},
{"tool": "cancel_pending_order", "after": "get_order_details", "result_contains": "pending", "same_arg": "order_id"}],
"max_calls_per_arg": [{"tools": ["exchange_delivered_order_items", "modify_pending_order_items"], "arg": "order_id", "max": 1}],
"values": [{"tool": "cancel_pending_order", "arg": "reason", "allowed": ["no longer needed", "ordered by mistake"]}]
}requires[].aftermay be a list: any one of them satisfies the prerequisite (two ways to authenticate).requires[].same_arg: the earlier call must carry the same value of that argument. Reading the status of order A no longer licenses cancelling order B. A call without a readablesame_argis a violation.max_calls_per_arg: at mostmaxsuccessful calls totoolsper value ofarg, e.g. one item change per order. A call whose result is an error is not counted: an agent that fixes a bad item id and retries changed the order once. A call without a readableargis a violation.values: the argument, when present, must be one ofallowed(compared as text, trimmed).
examples/policy_retail.json applies these to the tau2-bench retail domain. On 180 real tau2 retail runs from an outside test (three gpt-6-luna baselines, a same-model candidate, a weaker model and a sabotaged prompt) it fires on 0 of the 120 baseline and same-model runs, 5 of 30 weaker-model runs and 1 of 30 sabotaged runs. Still not expressible: confirmation before a change, one tool call per turn, joins against earlier results (payment method on file, item availability, price difference), and anything semantic. A clean `policy` result is not a compliance certificate.
05 / TRACE FORMATS
faultgate reads exports from common agent-observability tools and maps them onto the same span attributes so every check, policy, and judge runs without alterations. Format is auto-detected or specified via --format.
| --format | Export | Steps come from |
|---|---|---|
otlp | OTLP/JSON, GenAI semantic conventions | execute_tool spans and tool calls inside chat messages |
openinference | OTLP with openinference.span.kind (Arize Phoenix) | TOOL spans: tool.name, tool.parameters or input.value, output.value |
langfuse | trace objects with observations (GET /api/public/traces/{id}) | TOOL observations; level: ERROR + statusMessage become span errors |
langsmith | a list of runs | run_type: tool runs; error becomes a tool error |
braintrust | a list of logged spans | span_attributes.type: tool spans |
06 / DATA STAYS LOCAL: REDACTION
faultgate reads traces in memory and never writes payloads to disk or remote servers. When sending trace text to API judges or rendering failure reasons in CI comments and JSON reports, credentials and PII are masked by default:
| --redact | Masks | Needs |
|---|---|---|
builtin (default) | emails, credit cards (Luhn-checked), US SSNs, phone numbers, IPv4/IPv6, API keys, bearer tokens, JWTs | nothing (stdlib regex) |
presidio | the above plus Presidio's recognisers: person names, locations, more | pip install 'faultgate[pii]' and a spaCy model |
off | nothing | none |
Rules always see raw values to evaluate business logic accurately; only exported summaries are masked: step 2: update_profile.email '<EMAIL>' != session enduser.id '<EMAIL>'.
07 / IN CI
- uses: Faultline-lab/faultgate@main
with:
traces: traces/candidate.json # exported by your agent's OTel pipeline
band: traces/band.json # from `faultgate baseline`, committed
golden: traces/golden.json # optional
policy: traces/policy.json # optional
format: auto # auto, otlp, langfuse, langsmith, braintrust, openinference
redact: builtin # builtin, presidio, off
comment: "true" # upsert PR comment (needs pull-requests: write)- Job summary: Writes full Markdown report with p-values, broken rules, and latency/cost deltas to the GitHub Actions job summary.
- PR comment: Upserts one PR comment in place across pushes (tracked via
<!-- faultgate -->). Requirespermissions: pull-requests: write. - Audit artifact: Uploads
faultgate-auditartifact containingverdict.json(with SHA-256 hashes of inputs),failing_traces.json, andrepro.sh. No raw prompts or payloads are copied. - Step output: Exposes final outcome as
steps.gate.outputs.verdict(PASS, FAIL, or INCONCLUSIVE).
08 / HOW MUCH TO TRUST A VERDICT
Every check and judge is scored against human failure-mode labels on 200 real agent runs (FAULTLINE P4), reported on all 200 and on P5's frozen test split (n = 60). Regenerate with scripts/calibrate.py.
| Check | Kind | Positives | TPR | TNR | κ (n=200) | κ (P5 test, n=60) |
|---|---|---|---|---|---|---|
search_loop | rule | 36 | 1.00 | 0.99 | 0.98 | 1.00 |
abstention | rule | 1 | 1.00 | 1.00 | 1.00 | — (0 positives) |
policy | rule | synthetic | 4/4 P9 categories | 0 FP on 290 real traces | — | — |
context_overflow | rule | synthetic | finish-reason and provider-error forms in tests/test_checks.py | 0 FP on the 125 shipped real traces | — | — |
wrong_answer | golden | 4 | 1.00 | 1.00 | 1.00 | 1.00 |
truncation | golden | 1 | 1.00 | 1.00 | 1.00 | — (0 positives) |
wrong_direction | Laya judge | 1 | 1.00 | 0.61 | 0.02 | 0.00 |
For comparison, the same search_loop question put to judges instead of a rule: Laya κ 0.09, GLM-5.3 (API) κ −0.03. Where a failure is structural, code beats every model we measured, which is why the default checks are rules.
search_loopis solid on this task family. The human coder saw the same structural signals, so κ measures agreement with that coding, not ground truth from nowhere.abstention and truncationhave one positive each to learn from. abstention is a phrase list; a paraphrase it doesn't know is a miss. It was tuned on question-answering runs and then narrowed after an outside test on tau2 retail support runs, where "cannot" and "unable to" fired on 21 of 180 final answers that were policy reminders, authentication refusals and explanations of what a tool cannot do. It now fires on 1 of those 180 ("couldn't locate the ... payment method"); the P4 numbers above are unchanged.wrong_answeragrees with the human verdict on all 21 answered runs. It is substring containment, case-insensitive: right for short factual answers, wrong for free-text ones — say what "expected" means for your task before you trust it.policyhas no human-labelled positives: FAULTLINE's agent rejects hostile calls before they become steps, so its traces never contain an executed attack. Recall is by construction on the P9 attack shapes; the number that matters is zero false positives on real runs.context_overflowtests whether the run aborted due to context length exhaustion. It fires on finish reasons and provider error payloads with 0 false positives across the 125 benchmark traces.wrong_directionis the only check that needs reading, and the only local judge we have is noise on it (fires on 39% of clean runs). It ships because the contract is the product: the day a local model scores κ ≥ 0.7 on it, that's a one-line adapter, and this harness is what proves it.Laya's contextis 512 tokens. faultgate compacts the trace to fit (answer and termination first, middle steps elided) and counts every call that still overflows; the count is printed.
| Check | Kind | Measured trust | Source |
|---|---|---|---|
repeated_call | rule | κ 0.95 vs a blind second rater (Claude Opus 5.5) on 97 real runs | FAULTLINE P18 |
unrecovered_tool_error | rule | Caught 13 of 23 unrecovered errors confirmed by the blind second rater (Claude Opus 5.5) (recall 0.57, κ 0.54); misses plain-text errors and run-ending API failures (faultgate has no check for those yet; read flagged traces manually) | FAULTLINE P18 |
Span error = error.type or OTLP status code 2; P18 measured error.type only. Benchmark traces from Exgentic/agent-llm-traces-v2.
09 / WHAT IT DOESN'T DO YET
- Premature stop: answered with an intermediate entity of the chain. Needs the traversal chain, not just the final answer.
- Semantic injection checks: the agent obeyed text it read. P9 has the taxonomy; needs a judge that scores.
- Running your agent: faultgate reads traces; it never executes anything.
10 / BUILT ON FAULTLINE
FAULTLINE is the research workbench behind this tool: 30 days of simulator, 16 measured projects, two papers. faultgate is the part you install. Every number in the faultgate README links back to the run that produced it.
Ship the ones you can measure.
Install faultgate for local release gating in CI, or book an audit to build your domain policy pack.