13.03

Tracing FastAPI and agents with @observe

skillmaxingPython with AITracing FastAPI and agents with @observe
Visual lesson

Tracing FastAPI and agents with @observe

Included with Pro · 4:14
Lessons · 988 words

The drop-in from the last lesson gives you generations with no parent. @observe() gives them a family. Put the decorator on a function and the call becomes an observation: the outermost observed call in a request becomes the trace, every observed function it calls becomes a nested span, and any OpenAI call made through the drop-in attaches itself to whatever span is current. You describe the structure once, with decorators, and the tree assembles itself at run time.

Here is Relay's answer path with two observed functions. The retrieval step becomes a span under answer, and the model call becomes a generation under it too, because the drop-in looks up the current span through the same context the decorator sets.

Pro

Continue reading

Pro unlocks every video lesson, the full notes and runnable code across the Python with AI course, from the language itself to agents, MCP, Langfuse and deployment.

Unlock full access to
Python with AIAI researchComplete system design
30% off with LAUNCH30ends in 7h 40m
Buy now
View all plans ·Already Pro? Sign in
124 online