The 10-percent trace sample every agent engineering team pulls
Installs a weekly sampling gate on agent runs that surfaces loops and cost spikes before they reach finance review.
Acme Corp lost $18k when a LangGraph agent retried a failing ServiceNow ticket 400 times overnight.
The play, step by step
- Engineering lead exports the prior seven days of agent runs from LangGraph into a parquet file stored in S3.
- Data engineer runs the fixed 10-percent random sampler script that selects 200 traces and tags them with run_id and cost.
- On-call SRE loads the sample into the internal dashboard and flags any trace whose retry count exceeds 5 or whose token spend exceeds $4.
- SRE creates a ServiceNow incident for each flagged trace and assigns it to the owning agent owner within four hours.
- Agent owner must close the incident with a one-line root cause and a code diff link or escalate to the engineering manager.
- Engineering manager updates the shared agent decision log in Notion with the closed incidents before the next weekly sample.
Setting the sample size
Fix the rate at 10 percent or 200 traces, whichever is smaller, so the review never exceeds two hours for a two-person SRE pair.
When to run this play
Run it every Monday at 09:00 UTC once an agent has executed more than 500 tool calls in any seven-day window or when weekly spend on that agent exceeds $2,000.
Watch-outs
Stop the play and page the security team if any sampled trace shows an agent calling an unapproved external API or writing to a production database table outside its declared schema.
flowchart TD
A["Export LangGraph runs"] --> B["Run 10pct sampler"]
B --> C["Flag high retry or cost"]
C --> D["Create ServiceNow incident"]
D --> E["Owner closes with diff"]
E --> F["Log in Notion"]
F --> G["Next Monday sample"]
Your first week
Export last week’s LangGraph runs for your highest-spend agent and run the sampler script this Monday.