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

ASGI tracing uses the standard OpenTelemetry ASGI middleware and routes request
spans through Judgment.

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

**uv**

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

**pip**

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

```python title="asgi_tracing.py"
from judgeval import Tracer
from opentelemetry.instrumentation.asgi import OpenTelemetryMiddleware

Tracer.init(project_name="asgi_app")


async def application(scope, receive, send):
    await send(
        {
            "type": "http.response.start",
            "status": 200,
            "headers": [(b"content-type", b"text/plain")],
        }
    )
    await send({"type": "http.response.body", "body": b"hello"})


app = OpenTelemetryMiddleware(application)
```
