---
title: "LiteLLM Lens"
url: "/docs/proxy/lens"
canonical_url: "https://docs.litellm.ai/docs/proxy/lens"
type: "docs"
last_updated: "2026-11-22"
summary: "Trace agent runs and investigate recurring failures with LiteLLM Lens."
related:
  - "/docs/adaptive_router"
  - "/docs/proxy/lens/deployment"
---
# LiteLLM Lens

> Index of all LiteLLM docs: https://docs.litellm.ai/llms.txt


<p>
  <a className="button button--primary button--sm" href="https://forms.gle/3GC1Ner4vjthGWi18">Early access</a>
</p>

![Agent swarms flow through the LiteLLM gateway into one trace per run, and LiteLLM Lens feeds improvements back.](/img/lens/lens_hero_labeled.gif)

Once your agents are in production, you cannot manually review every trace.

LiteLLM Lens uses AI agents to analyze your agent traces and find recurring problems. You specify the expected behavior. Lens investigates failures, groups similar problems, and links each finding to the original traces.

Use **Lens > Traces** to manually inspect individual runs. Use **Lens > Investigations** to investigate a set of runs, on demand or on a schedule.

Before setup, turn on **Demo data** at the top right of Lens to explore sample traces, investigations, and linked evidence. Turn it off to return to your own workspace. To see the fields of a finding before you set anything up, read the [sample finding](./api.md#read-findings) in the API reference.

## Get started

Lens runs on its own. Start Docker, then run this in an empty folder:

```sh
curl -fsSLO https://raw.githubusercontent.com/BerriAI/lens/main/deploy/lens/compose.yaml && docker compose up --wait && docker compose logs -n1 credentials
```

Open [http://localhost:4318/ui/](http://localhost:4318/ui/) and paste the setup token that the command prints. You do not need a LiteLLM gateway, Kubernetes, or a model provider key. The [standalone quickstart](./deployment/local.md) covers sign-in and the first trace.

If your team already runs Lens, [send your first trace](./first-trace.md). Choose your framework, give the agent a name, and run the example.

For a team, deploy Lens on [a server](./deployment/server.md) or [Kubernetes](./deployment/kubernetes.md), or [add it to your LiteLLM dashboard](./deployment/litellm.md). If Lens already runs, [connect that deployment to your gateway](./deployment/litellm.md#1-get-the-lens-address). Each guide ends with a connection check and a first trace.

**See your coding agent sessions:** start Lens, generate a tracing key, then install the Lens plugin for [Claude Code](./coding-agents.md#claude-code) or [Codex](./coding-agents.md#codex). Open **Traces** to see the recorded activity.

Once traces are available, [run an investigation](./investigations.md) or use the [API reference](./api.md).

Use [Model optimizations](./model-optimizations.md) to compare models on live traffic or a saved dataset. Choose Live, Shadow, or Offline and inspect quality, cost, latency, and individual answers.

## How Lens works

**1. Capture your agent's traces**

Send traces from your agent to Lens. Open a run to inspect its inputs, responses, and tool calls, along with latency and cost.

![Lens Traces page showing support agent runs with inputs, duration, cost, findings, and user feedback.](/img/lens/overview-traces.webp)

**2. Find where your agent falls short**

Run an investigation to find problems across your traces. Review findings with examples, suggested fixes, and how often each problem occurs in the traces analyzed.

![Lens finding showing repeated order lookups, a suggested handoff to support, and the share of affected traces.](/img/lens/overview-finding.webp)

**3. Turn those runs into test cases**

Save runs into a dataset and add the responses you expect. Export the dataset to test changes to your agent's prompts, tools, or models.

![Lens dataset with support requests, recorded replies, expected responses, and an Export JSONL button.](/img/lens/overview-dataset.webp)

## Related pages

- [Adaptive Router (Beta)](https://docs.litellm.ai/docs/adaptive_router.md)
- [Set up Lens](https://docs.litellm.ai/docs/proxy/lens/deployment.md)
