reliable · intermediate · 40 min
See every step: traces
Record every model call and tool call of a run so you can see where the time and money went.
HANDS-ON LAB · YOU RUN IT ON YOUR MACHINE · 4 STEPS
-
Start Langfuse on your machine
Run this to check
git clone https://github.com/langfuse/langfuse.git && cd langfuse && docker compose up -dYou pass when
The containers start. The first start pulls several images and takes a few minutes.
-
Check that it answers
Run this to check
curl -s -o /dev/null -w "%{http_code}\n" http://localhost:3000/api/public/healthYou pass when
200. Open http://localhost:3000, create a local account and a project, and copy its two keys into your environment.
-
Send one span per model call and per tool call from your harness
Run this to check
uv run --with openai --with langfuse harness.py "Which file here is the largest?"You pass when
One new trace in the dashboard, with tool calls nested under the run and token counts on each model call.
Files you write
- harness.py
-
Find the slowest step and the most expensive step of that run
Run this to check
cat TRACE-NOTES.mdYou pass when
Two lines naming each step, with its seconds and cost, and one idea to cut each.
Files you write
- TRACE-NOTES.md
No transcript here on purpose. This page does not show terminal output, because model answers differ from run to run. Each step says what a pass looks like; your own terminal is the proof.