Agent failure checks inside your existing pytest tests.
No tracing setup, no collector, no account, no network, no LLM judge. Install it, run pytest, and every test that drives an agent is checked for the failures answer-only asserts miss.
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-zeroFAILED 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 failures01 / THE CHECKS
| Check | On by default | Fires when |
|---|---|---|
search_loop | Yes | The run ends with no answer after at least 5 tool calls, and at least half the results it saw were empty. |
repeated_call | Yes | The same tool is called 3 or more times with the same arguments and gets the same result each time. |
unrecovered_tool_error | Yes | A tool call fails (error flag, Error: / Exception: / traceback result, or an error field) and that tool never succeeds later in the run. |
unrecovered_model_error | Yes | A 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_overflow | Yes | A model response stops at the token limit (length, max_tokens, ...) or the provider rejects the prompt as too long. |
policy | Yes | A 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). |
abstention | No | The 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
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.
Captured in memory; checks evaluate on test completion; failing checks raise descriptive test failures.
03 / POLICY CONFIGURATION
| Policy key | Meaning |
|---|---|
allow | Only these tools may be called. |
deny_patterns | Case-insensitive literal strings that must not appear in any argument. Replaces built-in denied patterns. |
max_arg_chars, max_calls | Per run thresholds for longest argument payload and total tool calls. |
require_complete | The run must end with an answer and no escaped exception. |
tools.<name>.max_calls | Maximum invocations allowed for this specific tool per run. |
tools.<name>.limits | Numeric argument maxima; dotted paths reach nested keys ($900.00 counts as 900). |
tools.<name>.allowed_values | The argument must match one of the allowed literal values. |
tools.<name>.required_args | These arguments must be present in the tool call. |
tools.<name>.identity_arg | This argument must match the run user_id. |
tools.<name>.requires | These prerequisite tools must have succeeded earlier in the run. |
04 / SUPPORTED SDKS
| Package | Tested version | What is captured |
|---|---|---|
openai | 2.54.0 | chat.completions.create / parse / stream, responses.create / parse / stream; sync and async; streaming; with_raw_response. |
anthropic | 1.17 | messages.create, messages.stream, and beta equivalents; sync and async; streaming; server tool results. |
litellm | 1.106.2 | completion, acompletion (underlying call through OpenAI SDK counted once). |
langchain-openai / langchain-anthropic | 1.7 | ChatOpenAI, ChatAnthropic with bound tools. |
opentelemetry-instrumentation-openai-v2 | 2.4b0 | Runs alongside faultgate-zero; both record. |
pytest-xdist | 3.8 | -n with merged reports at controller. |
05 / REPORTS & PLUGINS
| Report option | Output and description |
|---|---|
--fgz-json PATH | Writes a JSON summary with masked test identifiers, run names, and failure reasons. |
--fgz-markdown PATH | Writes a summary table of failed runs, formatted for GitHub Actions step summary. |
--fgz-export-otlp PATH | Exports 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
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
- 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_callcalls. - 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
faultgate-zero
Agent failure checks inside your existing pytest tests.
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 with agent test coverage?
FAULTLINE offers fixed-scope diagnostic and production reliability audits. Production audits install and configure these tools when compatible.