---
title: "FastAPI Tracing"
description: "Trace FastAPI request spans with Judgment."
sidebar:
  label: "FastAPI"
seo:
  title: "FastAPI Tracing with Judgment | Integration Docs"
  description: "Trace FastAPI spans with Judgment to connect application behavior to production AI agent monitoring and evaluation."
---

FastAPI tracing uses the standard OpenTelemetry FastAPI instrumentation and
routes request spans through Judgment.

{/* @test-flow
  id: tracing-web-fastapi
  lang: python
  env: JUDGMENT_API_KEY, JUDGMENT_ORG_ID
*/}

**uv**

```bash
uv add judgeval fastapi opentelemetry-instrumentation-fastapi
```

**pip**

```bash
pip install judgeval fastapi opentelemetry-instrumentation-fastapi
```

```python title="fastapi_tracing.py"
from fastapi import FastAPI
from judgeval import Tracer
from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor

Tracer.init(project_name="fastapi_app")

app = FastAPI()
FastAPIInstrumentor.instrument_app(app)


@app.get("/hello")
async def hello():
    return {"message": "hello"}
```
