AI Platform Masterclass · Phase 13 · Observability

Your AI said four seconds and a polite answer.

Underneath that answer: a retry you paid for twice, a policy document over a year stale, and a customer’s SSN one missing guardrail from going out the door. You cannot operate what you cannot see. Run the request, then flip the X-ray.

Why was my loan application declined?
Press “Send the request” to watch it answer.

This is everything the business sees by default. A polite answer and a spinner. It is also everything an attacker, an auditor, and your CFO cannot see.

What you were just looking at

Three ideas, built from nothing. Once you have them, every observability tool on earth is a spelling of the same thing.

1

A span is one unit of work

A single step, with a start, an end, and a bag of attributes: what went in, what came out, how long, how much. In the X-ray, every row was one span.

2

A trace is spans, nested

One request fans out into many spans, parented into a tree. The trace is the whole story of one request. The waterfall you scrubbed was a trace.

3

AI needs three extra signals

Classic monitoring watches latency and errors. AI systems fail while both look perfect, so you also record tokens, cost, and quality. That is the whole difference.

The same idea in Langfuse and OpenTelemetry

Your company uses Langfuse today. The reason we learn the concept first is so that stays an implementation detail, not the lesson.

The concept

Wrap a unit of work so it records its own start, end, inputs, outputs and cost. That wrapped record is a span. Nested spans are a trace. Nothing here is a product.

# A span is any unit of work that reports itself.
start = now()
result = policy_agent(question, passages)   # the work
emit_span(
    name   = "policy_agent",
    start  = start,
    end    = now(),
    input  = {question, passages},
    output = result,
    tokens = result.usage,        # AI-specific
    cost   = price(result.usage), # AI-specific
)

The point: three spellings, one idea. Learn the middle column and the left and right are just syntax. Swap Langfuse for Arize or Braintrust tomorrow and you already know exactly what to look for.

Why a bank pays for this

Each of these is an incident that latency and error dashboards are blind to. All three were sitting inside the request you just ran.

Cost

The retry you paid for twice

An agent call times out, your framework retries it silently, and the user waits for both. On a "hello" nobody notices. On a 2,000-token policy request at bank volume, silent retries are a five-figure line item nobody can point to. The trace shows both attempts. The invoice only shows the total.

What the trace shows → A trace makes the ghost attempt visible, so cost has a cause, not just a number.

Quality

The answer that was wrong and sounded right

Retrieval pulled a policy document 14 months out of date. The LLM reasoned over it flawlessly and produced a confident, fluent, incorrect answer. Latency was fine. Error rate was zero. Nothing alerted. This is the failure mode classic monitoring cannot see, because nothing technically broke.

What the trace shows → Span attributes (which doc, which version, which score) turn "sounded right" into something you can actually audit.

Security

The SSN that almost went out

The agent copied a customer record into a draft that happened to contain an SSN. A 70ms guardrail span caught it and redacted before send. Delete that span and you have emailed a customer their own government ID in plaintext, and you would never have known it happened. In a bank, that is a reportable incident.

What the trace shows → The guardrail is only trustworthy because it is observable: every block is a span you can prove to an auditor.

In the interview

“How would you tell a slow request from an expensive one from a wrong one?”

The answer is three different signals on the same trace: latency for slow, token-and-cost attributes for expensive, and eval or retrieval-quality attributes for wrong. If you can say that, you sound like someone who has operated a system, not read about one.

On your real stack

Add @observe() to one agent this week.

Pick the most expensive agent in your LangChain graph, wrap it, and watch one real trace in Langfuse. Find one silent retry or one oversized context. That single trace will teach you more than the next ten articles.

Every lesson has the same 12-step spine

This prototype delivered the starred steps.

Visual intuition
First principles
Internals
Concept → tool
5Azure / AWS / GCP
Common mistakes
Security angle
8SRE angle
9Hands-on lab
10Mini project
11Architecture review
12Mastery quiz

One lesson, one differentiated topic from the moat, at full depth. Multiply this by the spine and you have the masterclass: a system a senior engineer can reason about, not a pile of articles. This is the format. The question is whether we scale it.