Query Pydantic Logfire from Sazabi: SQL, exceptions and deep links
Last verified on Nov 8, 2026.
Pydantic Logfire stores OpenTelemetry traces and metrics, and it answers questions in SQL. Sazabi, the AI-native observability and security platform, connects its agent to Logfire's hosted MCP server. A thread about a failing service can then pull Logfire records without anyone switching tools.
What the Sazabi agent can do with Logfire
Logfire's MCP server authenticates with OAuth and dynamic client registration, so you authorize in the browser. The Sazabi connector works against your workspace on Logfire's US region, logfire-us.pydantic.dev. Once connected, the agent can:
- run SQL queries against your Logfire datasets
- find the most recent exceptions in a given file
- inspect the Logfire records schema to write correct queries
- browse projects, alerts, dashboards, channels and variables
- generate deep links into the Logfire UI for traces and issues
Logfire's guide names the tools. query_run runs SQL, and query_schema_reference returns the schema first so the query uses real column names. query_find_exceptions_in_file returns, per Logfire's server card, the 10 most recent exceptions for a source file path. project_logfire_link makes a link to a specific trace. The alert tools include alert_list and alert_history.
Two limits are worth knowing. Organization admins can restrict every external MCP client to read-only tools. And on Logfire Cloud the MCP server has its own query limits: a cap on concurrent queries and a daily budget for each organization. When the budget runs out, Logfire refuses MCP queries until it refills. The web UI is not affected.
Questions it answers
- Which exceptions came from this file in the last day?
- What does the Logfire records schema call the field I need?
- Which alerts exist for this project, and what is their history?
- Can I get a link to the trace behind this exception?
- Did this error start before or after the last deploy, going by the records Logfire holds?
A worked example: from a file name to a trace link
You are looking at a stack trace that names app/billing/charge.py. In a Sazabi thread you ask:
Using Logfire, find the most recent exceptions in app/billing/charge.py. For the
newest one, give me a link to its trace. Then check the schema and run a query that
shows how many exceptions came from that file in the last 24 hours.The agent can call query_find_exceptions_in_file with the path. Per Logfire's server card that returns up to 10 recent exceptions. It can then call project_logfire_link for the newest one to produce a deep link, and query_schema_reference to learn the column names before query_run counts the rest. The schema step matters because SQL fails fast on a guessed column name.
Read the result in two parts. If all ten exceptions are the same type, you have one bug and the link takes you to the exact trace. If they differ, the file has several failure modes, and the count from query_run tells you which dominates. Then bring in the logs: ask Sazabi to search the service's own records around the timestamp of the newest exception. If the agent reports a query-limit error, the daily MCP budget is probably spent, so wait for the refill or use the Logfire UI. If no tools appear at all after you connect, disconnect and reconnect to restart the OAuth flow, and check that your Logfire account is in the US region.
How it fits with other integrations
Logfire works with OpenTelemetry data, and your own services can send OpenTelemetry to Sazabi too. See the OpenTelemetry page. Other stacks the agent can query are Honeycomb and Axiom. See observability tools for the full set, or AI frameworks if your service is an LLM app.
Ways to connect
- Pydantic Logfire (MCP connector): Give the Sazabi agent tools to query OpenTelemetry traces and metrics, surface recent exceptions, and browse projects, alerts, and dashboards in Logfire.
Frequently Asked Questions
Which Logfire region does the Sazabi connector use?
The US region, logfire-us.pydantic.dev. You need a Pydantic Logfire account in that region. Logfire also runs an EU instance, but the Sazabi docs only cover the US one.
Does Sazabi store Logfire data?
No. It is an MCP connector. The Sazabi agent queries Logfire at question time, and nothing is copied into Sazabi.
Can the agent write SQL against Logfire?
Yes. The connector runs arbitrary SQL queries against your Logfire datasets through the OpenTelemetry-native API, and the agent can inspect the Logfire records schema first so it uses real column names.
Can an admin limit what the agent can do in Logfire?
Logfire lets organization admins limit every external MCP client to read-only tools. Logfire Cloud also applies query limits to MCP, including a daily query budget per organization.
Sources
- OAuth with dynamic client registration, US region logfire-us.pydantic.dev, SQL queries, recent exceptions in a file, records schema, projects, alerts, dashboards, channels, variables, deep links (accessed Nov 8, 2026)
- Pydantic Logfire has one connection method: an MCP connector (accessed Nov 8, 2026)
- Tool names query_run, query_schema_reference, query_find_exceptions_in_file, project_logfire_link, alert_list and alert_history; US and EU endpoints; org admins can limit external MCP clients to read-only tools; daily MCP query budget on Logfire Cloud (accessed Nov 8, 2026)
- Server URL https://logfire-us.pydantic.dev/mcp over streamable HTTP with OAuth 2; query_find_exceptions_in_file returns the 10 most recent exceptions for a source file path; query_run runs SELECT queries (accessed Nov 8, 2026)