Overview
The Cookbook is a set of end-to-end guides: each follows a real goal from start to finish, stitching several Logfire features into one journey. Where the feature pages tell you what each part does, these show you how they fit together to get a job done. Every guide is runnable: copy the code, send the data, and see the result in Logfire.
- Instrument and evaluate an agent: build a Pydantic AI agent, see its traces, tokens, and cost, then measure its quality with evals (repeatable tests of an AI’s output quality) and catch a regression. ~25 min · for AI engineers.
- Debug a slow endpoint: trace a slow request in a FastAPI + Postgres app down to the exact SQL query behind it, and fix it. ~15 min · for backend and site reliability engineers.
- Debug a slow tool call: prove in one trace that a slow agent is stuck in a tool, not the model, and find the slow query inside it. ~15 min · for AI engineers.
- Roll out a prompt safely: change a prompt, test it, promote it with a label, and roll it back, without a redeploy. ~15 min · for AI engineers.
- Track and alert on LLM cost: capture the cost of your LLM calls, chart it on a dashboard, and get alerted when spend spikes. ~15 min · for AI engineers and engineering leads.
Start with the quickstart to send your first trace, or pick your path by role.