{
 "schema_version": 1,
 "generated": "2026-11-09",
 "id": "pydantic-logfire--instrument-a-fastapi-app-with-logfire",
 "repo": "pydantic/logfire",
 "repo_url": "https://github.com/pydantic/logfire",
 "repo_slug": "pydantic-logfire",
 "title": "Instrument a FastAPI app without manual tracing",
 "page_title": "How to instrument a FastAPI app without manual tracing with Logfire",
 "summary": "Call Logfire.instrument_fastapi on your app to trace requests automatically.",
 "who": "A backend developer running a FastAPI service.",
 "problem": "Adding spans to every endpoint by hand does not scale.",
 "outcome": "Request traces for every route of your FastAPI app.",
 "steps": [
  "Install with `pip install logfire`",
  "Create your FastAPI app as usual",
  "Call Logfire.configure() and then Logfire.instrument_fastapi(app)",
  "Instrument your database connector and http library the same way, as the README suggests"
 ],
 "agent_prompt": "Using pydantic/logfire, add logfire.configure() and logfire.instrument_fastapi(app) to <my FastAPI app> and list the other libraries I should instrument next.",
 "agents": [
  "claude-code",
  "codex",
  "cursor",
  "gemini-cli"
 ],
 "difficulty": "Intermediate",
 "time": "20 minutes",
 "basis": "readme",
 "caveat": "",
 "category": "Software and DevOps",
 "tags": [
  "Software and DevOps"
 ],
 "lang": "python",
 "requirements": [
  "Python with pip",
  "A Logfire account, since the backend is a closed source hosted service",
  "uv for the uvx commands"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [
  {
   "tag": "data",
   "notice": "Request data is sent to the hosted backend; check what your routes carry first."
  }
 ],
 "best": false,
 "score": 0.8,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/pydantic-logfire/instrument-a-fastapi-app-with-logfire/",
 "md": "https://dedupedai.com/use-cases/pydantic-logfire/instrument-a-fastapi-app-with-logfire/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/pydantic-logfire--instrument-a-fastapi-app-with-logfire.json",
 "api_version": "v1"
}
