See every step: traces
Record every model call and tool call of a run so you can see where the time and money went.
You build: A local tracing dashboard showing one run of your harness, step by step, with cost.
- Docker
- Python 3.11 or newer and uv
- Lab 30 done
-
01Start Langfuse on your machine
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.
-
02Check that it answers
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.
-
03Send one span per model call and per tool call from your harness
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.
-
04Find the slowest step and the most expensive step of that run
cat TRACE-NOTES.mdYou pass when: Two lines naming each step, with its seconds and cost, and one idea to cut each.
The check runs on the computer, not on your word: a step passes when its command exits with 0 there.
Computers are not set up on this site yet. Run each command on your own machine and compare with "You pass when".
Commands run in labs/41-tracing and may take up to 60 seconds each. Every command starts a new shell: put keys and settings in a .env file there, it is loaded each time.