Overview
See every decision your agent makes and everything it triggers. Tell a prompt problem from a service problem before you change production.
Logfire turns an agent run into one trace (the full journey of one request or agent run, made of nested spans): the model calls, tool calls, database queries, API requests, and response your user receives.
Before you explore: this page explains what Logfire can show once your application is sending traces. Send your first trace →
-
Read the messages, model settings, tool arguments, results, tokens, cost, and latency that produced one answer.
-
Follow a tool call into the database, API, queue, or service it touched. The trace keeps the causal chain intact.
-
Find expensive or unreliable paths
Compare models and agent runs by cost, error rate, latency, tokens, tool calls, and turns. Then drill into the trace.
An agent recommends an item that cannot arrive by Friday. The trace can show two very different failures.
- The agent never passed the delivery constraint to
search_inventory. That is a prompt, model, or tool-selection problem. - The agent passed the constraint, but the inventory service returned stale delivery data. That is a system problem.
Both failures look like a bad answer to the user. They need different fixes. Logfire keeps the agent’s decisions and the work they triggered in the same trace, so you can change the right part of the system.
-
Build datasets from the cases that matter, compare changes before release, and score live traffic after it ships.
-
Version prompts, test them against representative inputs, and promote the version that performs better.
-
Ask production data better questions
Query traces with SQL yourself, or connect the Logfire MCP server so your coding agent can investigate with you.
Start with a one-line integration for Pydantic AI, OpenAI, Anthropic, LangChain, or another supported framework. Logfire also accepts OpenTelemetry (OTel), the open industry standard for collecting traces, metrics, and logs, so a TypeScript frontend, Python agent service, and Go backend can all appear in the same trace.
To cap what your app can spend on models, fail over between providers, or keep one API key for many models, route your calls through the AI Gateway. This is optional: the instrumentation above is all you need to trace and debug your agents.