C.W.K.
Stream
Lesson 02 of 05 · published

Observability and Evaluation

~32 min · observability, evals

Level 0Observer
0 XP0/40 lessons0/12 achievements
0/100 XP to next level100 XP to go0% complete

You cannot improve what you cannot replay

Agent observability is more than console logs. You need traces of model calls, tool calls, inputs, outputs, costs, latency, approvals, errors, and stop reasons. You also need a way to turn failures into eval cases.

Evaluation closes the loop. Production failures become golden tests, graders, regression suites, and prompt/tool changes.

Trace the decision path

Record why the agent chose a tool, what the tool returned, what state changed, and whether a human approval or guardrail influenced the run. Redact secrets, but keep enough structure to debug.

Current OpenAI Agents docs frame traces as structured records of model calls, tool calls, handoffs, guardrails, and custom spans. Trace grading then lets you score those decision paths rather than treating the final answer as a black box.

For non-deterministic systems, evaluate behavior over datasets, not one heroic demo. Track task completion, accuracy, tool efficiency, cost, latency, and human correction rate.

Code

Trace event·json
{"run_id":"run_42","agent":"support_triage","event":"tool_call","tool":"web_search","args_redacted":{"query":"current docs"},"latency_ms":840,"cost_usd":0.002,"approval":"not_required","guardrail":"passed","ok":true,"next_decision":"read top official source"}

External links

Exercise

Design five eval metrics for an agent you might ship. Include one cost metric and one human-correction metric.
Hint
Metrics should change when behavior improves or regresses.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.