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
  1. Step 1 of 4

    Start Langfuse on your machine

    Run this to check

    git clone https://github.com/langfuse/langfuse.git && cd langfuse && docker compose up -d

    You pass when

    The containers start. The first start pulls several images and takes a few minutes.

  2. Step 2 of 4

    Check that it answers

    Run this to check

    curl -s -o /dev/null -w "%{http_code}\n" http://localhost:3000/api/public/health

    You pass when

    200. Open http://localhost:3000, create a local account and a project, and copy its two keys into your environment.

  3. Step 3 of 4

    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
  4. Step 4 of 4

    Find the slowest step and the most expensive step of that run

    Run this to check

    cat TRACE-NOTES.md

    You 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.