Provider Behavior Probes
Run a small, fixed suite of rule-scored probes against each provider on a schedule, so "is it us or the provider?" has an answer when tool calls, JSON output, refusals, limits or the model itself change.
cd examples && pytest observability_and_evaluation/test_provider_behavior_probes.pyWhat It Is
Synthetic monitoring for model providers. A fixed set of probes (the same requests, with deterministic settings) runs against each provider and model on a schedule. Each probe is scored by a rule, not by another model: did the reply parse as JSON with the required keys, did the tool call match the schema, did a harmless request get refused. Results are kept as a time series per behavior dimension, together with the model identifier the API reported and the rate-limit headers it returned. A change is reported when a dimension's pass rate drops clearly below its own baseline, or when the model ID or a limit changes.
It's black-box monitoring, as SRE teams have always done for dependencies, pointed at the dependency that changes most quietly.
The Problem It Solves
Providers change things without announcing them. A model alias moves to a new snapshot, JSON mode starts adding a sentence before the object, tool calls stop filling an optional field, refusals rise for one category, a rate limit is lowered for your tier. Changelogs and status pages are late or silent on most of this.
Your own dashboards show the symptoms (parse errors up, conversions down) but can't tell you the cause. During an incident, the first hour goes on finding out whether your last deploy or the provider broke it. Research has documented this drift directly: the same model name has behaved measurably differently a few months apart.
How It Works
flowchart LR
S["Scheduler
(hourly, low QPS, cost cap)"] --> R["Run fixed probe suite
temperature 0, same requests"]
R --> C["Score with rules:
JSON keys · tool schema · refusal phrase"]
C --> T["Time series per dimension
+ model id + limit headers + vantage"]
T --> D{"Recent vs baseline"}
D -->|"pass rate dropped beyond noise"| A["Alert: dimension regressed"]
D -->|"model id / limit changed"| A2["Alert: provider changed something"]
D -->|"stable"| OK["Nothing to report"]
- Probe the behaviors you depend on. Organize probes by dimension: structured output, tool calling, refusals on benign requests, rate-limit headers, latency. Use your real schemas and representative prompts, not generic benchmarks.
- Keep probes deterministic and fixed. Same requests, temperature 0, versioned. Changing a probe resets its baseline.
- Score with rules. A JSON parser or a schema check is unambiguous. If you must use a judge for a fuzzy dimension, treat it as a secondary signal.
- Record the model ID the API returns on every call, plus the limit headers. These catch silent swaps directly.
- Compare recent runs with the dimension's own baseline, and require a drop that's both large and unlikely to be noise at that sample size. Don't alert from a single run.
- Record the vantage point. One account, tier and region can't see everything. Report findings as "measured from X", never as ground truth about the provider.
- Cap the cost. Probes are a sample, not a load test. Respect the provider's terms, and never try to measure rate limits by hitting them.
When to Use It
- Production features depend on specific provider behaviors: JSON output, tool calls, low refusal rates.
- You use model aliases that the provider can move, or several providers.
- Incident response keeps stalling on "is it us or them?".
When NOT to Use It
- Pinned, self-hosted models. Nothing outside your control changes. Your own regression tests cover it.
- A product with no strict format dependency where small behavior changes don't matter. The probes would report noise you'd never act on.
- As a replacement for monitoring your real traffic. Probes find provider changes. They don't measure your users' experience. Run both.
Trade-offs
- Coverage is what you probe. A change in a behavior you don't probe goes unseen. Add a probe after every provider-caused incident.
- Baselines need care. Changing a probe, a schema or the model you target resets the comparison. Version probes, and keep the history.
- Cost and quota. Hourly probes across providers and models add up. Probe a few representative cases per dimension, not your whole test suite.
Failure Modes
One run, one alert. A single failed probe pages someone at 3 a.m. Compare windows of runs against a baseline, with a minimum sample size.
Probing with temperature above zero. Normal sampling variation looks like a regression. Use deterministic settings, and expect small residual variation anyway.
Treating probes as ground truth. A probe from one region shows no change while users in another tier are affected. Attach the vantage point to every finding, and weigh it with user reports.
Model-judged probes that drift with the judge. A judge model is updated and every score moves. Use rule-based checks for anything you alert on.
Implementation Example
A probe runner with rule-based checks, deterministic settings, a per-run cost cap and a vantage tag, plus a detector that compares recent runs with a baseline per dimension and flags model-ID and limit-header changes. The tests simulate a provider that starts wrapping JSON in prose and another that silently swaps the model, and check that a stable provider produces no alerts.
cd examples && pytest observability_and_evaluation/test_provider_behavior_probes.py"""Provider Behavior Probes.
Providers change things without telling you: tool-call formatting, JSON
conformance, refusal behaviour, rate limits, which model actually answers.
Your own dashboards show symptoms but can't separate "our code" from "the
provider". A small, fixed probe suite run on a schedule can.
Each probe sends the same request every run, with deterministic settings, and
scores the reply with a rule (not a model). Results are kept as a time series
per dimension. A change is reported when the recent pass rate falls clearly
below the baseline, or when the model identifier or a rate-limit header
changes. Every result records where it was measured from, because one
account in one region can't see everything.
"""
from __future__ import annotations
import math
import time
from collections import defaultdict
from collections.abc import Callable
from dataclasses import dataclass, field
@dataclass
class Response:
text: str
model: str # the model id the API says answered, not the one you asked for
headers: dict[str, str] = field(default_factory=dict)
latency_s: float = 0.0
Client = Callable[[dict], Response]
@dataclass(frozen=True)
class Probe:
name: str
dimension: str # "tool_calling" | "structured_output" | "refusal" | ...
request: dict
check: Callable[[Response], bool] # rule-based scoring; deterministic
@dataclass
class Observation:
run_at: float
probe: str
dimension: str
passed: bool
model: str
rate_limit: str | None
vantage: str
@dataclass
class ProbeRunner:
probes: list[Probe]
client: Client
vantage: str # e.g. "eu-west / tier-2 account"; record it with every result
max_calls_per_run: int = 50 # hard cost cap; probes are a sample, never a load test
clock: Callable[[], float] = time.time
log: list[Observation] = field(default_factory=list)
def run(self) -> list[Observation]:
now, out = self.clock(), []
for probe in self.probes[: self.max_calls_per_run]:
request = {**probe.request, "temperature": 0}
try:
resp = self.client(request)
passed = probe.check(resp)
except Exception as exc: # an exception is a failed probe, not a crashed monitor
resp, passed = Response(f"error: {exc}", "unknown"), False
out.append(Observation(now, probe.name, probe.dimension, passed, resp.model,
resp.headers.get("ratelimit-limit-requests"), self.vantage))
self.log.extend(out)
return out
def _pass_rate(obs: list[Observation]) -> float:
return sum(o.passed for o in obs) / len(obs) if obs else 1.0
def detect_changes(log: list[Observation], baseline_runs: int = 7, recent_runs: int = 2,
min_drop: float = 0.15, z: float = 2.5) -> list[str]:
"""Compare the latest runs with the ones before them, per dimension."""
runs = sorted({o.run_at for o in log})
if len(runs) < baseline_runs + recent_runs:
return []
recent_t, base_t = set(runs[-recent_runs:]), set(runs[-(baseline_runs + recent_runs):-recent_runs])
findings = []
by_dim: dict[str, tuple[list, list]] = defaultdict(lambda: ([], []))
for o in log:
if o.run_at in base_t:
by_dim[o.dimension][0].append(o)
elif o.run_at in recent_t:
by_dim[o.dimension][1].append(o)
for dim, (base, recent) in sorted(by_dim.items()):
p0, p1 = _pass_rate(base), _pass_rate(recent)
# A drop counts only if it's both large and unlikely to be noise at this sample size.
se = math.sqrt(max(p0 * (1 - p0), 0.01) / max(len(recent), 1))
if p0 - p1 >= min_drop and (p0 - p1) / se >= z:
findings.append(f"{dim}: pass rate {p0:.0%} -> {p1:.0%} ({len(recent)} recent probes)")
for label, key in (("model id", "model"), ("rate limit header", "rate_limit")):
before = {getattr(o, key) for o in log if o.run_at in base_t}
after = {getattr(o, key) for o in log if o.run_at in recent_t}
if after - before and before:
findings.append(f"{label} changed: {sorted(map(str, before))} -> {sorted(map(str, after))}")
vantage = {o.vantage for o in log if o.run_at in recent_t}
return [f"{f} [measured from {', '.join(sorted(vantage))}]" for f in findings]Tool Landscape
| Tool | Notes |
|---|---|
| Datadog Synthetics, Checkly, Grafana synthetic monitoring | Scheduled synthetic checks; point them at your gateway's probe endpoint |
| promptfoo, Inspect | Fixed test suites you can run on a schedule |
| Provider response metadata | The model field and rate-limit headers on every response |
| Your LLM gateway | Natural place to run probes and tag results by provider and model |
Related Patterns
- Shadow Model Evaluation compares models on your real traffic. Probes watch one model over time on fixed inputs.
- Embedding Drift Detector watches your data drift. Probes watch the provider drift.
- Circuit Breaker for LLMs reacts to outages. Probes catch the quieter changes that never trip a breaker.
- LLM Gateway gives probes the same path as production calls.
Further Reading
- How Is ChatGPT's Behavior Changing over Time?, Chen, Zaharia and Zou, 2023
- Monitoring Distributed Systems, Google SRE Book. Black-box versus white-box monitoring.
Spotted something wrong or have a production story? Edit this page on GitHub.