1Choose the sample
Set the share of runs to score, the rolling window and the minimum number of samples before trend alerts.
2Wrap the agent call
Use watch() only when the monitor selects a run; unsampled traffic stays on its normal path.
3Record the report
Feed the deterministic report back to the monitor so it can update its baseline and rolling trend.
4Route the alert
Send a sustained drop, floor crossing or new severity to the channel your team already operates.
Watch a sampled production run
from agentleak import Monitor, watch
monitor = Monitor(sample=0.05, drop=10, on_alert=notify_team)
if monitor.should_sample():
with watch(project="support-bot") as run:
answer = agent(request)
monitor.record(run.report.to_dict())
Read the complete implementation guide →