ScriptsMay 12, 2026·2 min read

Logfire — Python Observability on OpenTelemetry

Logfire is Pydantic’s Python SDK for traces/metrics/logs on OpenTelemetry, helping teams add observability with minimal code and query data with SQL.

Agent ready

This asset can be read and installed directly by agents

TokRepo exposes a universal CLI command, install contract, metadata JSON, adapter-aware plan, and raw content links so agents can judge fit, risk, and next actions.

Stage only · 29/100Stage only
Agent surface
Any MCP/CLI agent
Kind
Script
Install
Single
Trust
Trust: Established
Entrypoint
logfire
Universal CLI install command
npx tokrepo install 67236d34-9663-4f58-a975-0a218f099c6d
Intro

Logfire is Pydantic’s Python SDK for traces/metrics/logs on OpenTelemetry, helping teams add observability with minimal code and query data with SQL.

  • Best for: Python teams who want quick, consistent observability for apps and agent backends
  • Works with: Python apps (e.g., FastAPI) and OpenTelemetry-compatible backends
  • Setup time: 10–30 minutes

Practical Notes

  • Quant: aim for 1 end-to-end request trace with spans for DB + HTTP within the first hour.
  • Quant: track p95 latency and error rate before vs after adding instrumentation.

Agent backend tip: make tool calls observable

If you run an agent service, the fastest win is instrumenting tool calls:

  • external HTTP requests,
  • database queries,
  • vector search,
  • and model API calls.

Name spans consistently (e.g., tool.http, tool.sql, tool.vector) so you can answer: where did time and failures go?

Data hygiene

Avoid logging secrets. Configure scrubbing/redaction early and review what ends up in traces before enabling in production.

FAQ

Q: Is the whole platform open-source? A: No. This repo is the open-source SDK and docs; the hosted platform is separate.

Q: Can I export to another backend? A: Yes—OpenTelemetry compatibility means you can target other OTel backends if needed.

Q: What should I instrument first? A: Start with request traces + tool calls, then add DB/HTTP client instrumentation.

🙏

Source & Thanks

Source: https://github.com/pydantic/logfire > License: MIT > GitHub stars: 4,236 · forks: 234

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets