Faultgate 0.5.0, Faultgate-Zero 0.2, Trace-to-Fixture 0.1 and Fault-Contract 0.1 are on PyPISee products →

What is faultgate-zero?

faultgate-zero runs automated structural checks during your normal pytest test suite. It inspects agent runs for loops on empty results, repeated identical calls, tool errors the agent ignored, provider outages hidden behind fallback text, answers cut short at token limits, and policy violations.

The plugin loads through pytest's pytest11 entry point. There is nothing to import in your test code unless you want explicit named runs or test-level assertions.

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 faultgate-zero
EXAMPLE PYTEST FAILURE OUTPUT
FAILED test_refund_agent.py::test_answers_about_an_order
faultgate-zero: 1 check fired on run 'test_refund_agent.py::test_answers_about_an_order' (3 steps, 4 model calls)
  repeated_call  step 3: lookup_order called 3x with identical arguments {"order_id":"1042"} and identical results
hint: mark the test with @pytest.mark.faultgate(skip=[...]) if a check is expected to fire
...
faultgate-zero: 7 runs checked, 6 with failures
7
CHECKS (6 DEFAULT ON)
0
NETWORK CALLS OR JUDGES
1
RUNTIME DEPENDENCY (PYTEST)
MIT
ALPHA 0.2.0

01 / THE CHECKS

Built-in deterministic checks executed at the end of each test run.
CheckOn by defaultFires when
search_loopYesThe run ends with no answer after at least 5 tool calls, and at least half the results it saw were empty.
repeated_callYesThe same tool is called 3 or more times with the same arguments and gets the same result each time.
unrecovered_tool_errorYesA tool call fails (error flag, Error: / Exception: / traceback result, or an error field) and that tool never succeeds later in the run.
unrecovered_model_errorYesA model call raises (outage, rate limit, bad request) and no later model call succeeds, while the agent carries on, e.g. with a fallback message.
context_overflowYesA model response stops at the token limit (length, max_tokens, ...) or the provider rejects the prompt as too long.
policyYesA tool call breaks the policy file (.faultline/policy.json). With no file, only the built-in denied text applies (../, file://, ~/.ssh, /etc/passwd, id_rsa).
abstentionNoThe final answer says the information could not be found. Off by default, because many tests expect a correct not found response.

02 / HOW IT WORKS

In-process SDK wrapping with safe passthrough.

While your tests run, faultgate-zero wraps the client methods of supported model SDKs (OpenAI, Anthropic, LiteLLM). Each pytest test represents one agent run. Model requests, responses, and errors are collected in process memory.

The wrappers never change what the SDK returns or raises; streams and raw response objects pass through untouched. A bug in faultgate-zero never breaks your agent: the run is marked "capture incomplete", a warning is printed, and its checks are skipped.

pytest test
faultgate-zero
Model SDK

Captured in memory; checks evaluate on test completion; failing checks raise descriptive test failures.

03 / POLICY CONFIGURATION

Automatic project policy file (.faultline/policy.json).
Policy keyMeaning
allowOnly these tools may be called.
deny_patternsCase-insensitive literal strings that must not appear in any argument. Replaces built-in denied patterns.
max_arg_chars, max_callsPer run thresholds for longest argument payload and total tool calls.
require_completeThe run must end with an answer and no escaped exception.
tools.<name>.max_callsMaximum invocations allowed for this specific tool per run.
tools.<name>.limitsNumeric argument maxima; dotted paths reach nested keys ($900.00 counts as 900).
tools.<name>.allowed_valuesThe argument must match one of the allowed literal values.
tools.<name>.required_argsThese arguments must be present in the tool call.
tools.<name>.identity_argThis argument must match the run user_id.
tools.<name>.requiresThese prerequisite tools must have succeeded earlier in the run.

04 / SUPPORTED SDKS

Tested versions on Python 3.11, 3.12, and 3.13.
PackageTested versionWhat is captured
openai2.54.0chat.completions.create / parse / stream, responses.create / parse / stream; sync and async; streaming; with_raw_response.
anthropic1.17messages.create, messages.stream, and beta equivalents; sync and async; streaming; server tool results.
litellm1.106.2completion, acompletion (underlying call through OpenAI SDK counted once).
langchain-openai / langchain-anthropic1.7ChatOpenAI, ChatAnthropic with bound tools.
opentelemetry-instrumentation-openai-v22.4b0Runs alongside faultgate-zero; both record.
pytest-xdist3.8-n with merged reports at controller.

05 / REPORTS & PLUGINS

Structured output formats and extensible check plugins.
Report optionOutput and description
--fgz-json PATHWrites a JSON summary with masked test identifiers, run names, and failure reasons.
--fgz-markdown PATHWrites a summary table of failed runs, formatted for GitHub Actions step summary.
--fgz-export-otlp PATHExports captured runs as OTLP/JSON with OpenTelemetry GenAI attributes. Notice: OTLP export contains raw prompts, answers, and tool payloads (not redacted).

CHECK PLUGINS (ENTRY POINT)

Other packages can register checks through the faultgate_zero.checks entry point group. For example, fault-contract registers its schema verification check here. Plugin checks participate in standard command flags, test skips, and CI reporting.

06 / PRIVACY

Local execution boundaries and redaction defaults.

Nothing leaves your machine. Trace capture occurs entirely within process memory. There is no background telemetry, no cloud judge, and no hosted endpoint.

Built-in redaction masks emails, card numbers, API keys, bearer tokens, and JWTs in every failure reason and report.

07 / LIMITS

Documented operational limits and alpha status.
  • Status is 0.2.0 alpha: trace-based checks for existing pytest tests with no dependency on the faultgate package.
  • Only supported SDK methods are captured automatically; custom HTTP transports require explicit record_model_call calls.
  • 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.

08 / THE FAULTLINE SUITE

How FAULTLINE tools fit together across testing and release.
TESTING (ACTIVE)

faultgate-zero

Agent failure checks inside your existing pytest tests.

Current product →
TESTING

trace-to-fixture

Real agent runs become safe, small, repeatable fixtures.

Open product →
CONTRACT

fault-contract

Tool-call shape checks for request arguments and response results.

Open product →
RELEASE GATE

faultgate

Release gate over recorded traces with noise-aware statistical bands.

Open product →
FIREWALL

mcp-guard

Local firewall and integrity monitor for MCP tool calls.

Open product →

Need help with agent test coverage?

FAULTLINE offers fixed-scope diagnostic and production reliability audits. Production audits install and configure these tools when compatible.