Turn request spans into a compact observability snapshot: count work, failures, p95 latency, tokens, and cost.
Required APIdef summarize_spans(spans):
return {'count': ..., 'error_count': ..., 'p95_ms': ..., 'total_tokens': ..., 'total_cost': ...}BehaviorThink through the mechanism first if you want the extra reasoning step. It never blocks the editor.
summarize_spans([{'latency_ms': 10, 'error': False, 'tokens': 4, 'cost': 0.1}, {'latency_ms': 20, 'error': False, 'tokens': 6, 'cost': 0.2}])the trace answers what the request cost
summarize_spans([{'latency_ms': 10, 'error': True, 'tokens': 0, 'cost': 0.0}])failures remain observable
2 hidden edge tests run after the visible contract passes.
Run Tests to see the contract verdicts here.