Skip to main content

LiteLLM Lens

Beta

LiteLLM Lens is in Beta. Try it with your team and tell us what would make it easier to investigate agent behavior. Read our Beta policy before relying on Lens in production.

Early access

Agent swarms flow through the LiteLLM gateway into one trace per run, and LiteLLM Lens feeds improvements back.

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 > Findings to review recurring problems and open investigation history.

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 in the API reference.

Get started​

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

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/ 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 covers sign-in and the first trace.

Already run a LiteLLM gateway? Add Lens to it. People sign in with their LiteLLM login, and the users, teams and permissions you already set up in the gateway carry over to Lens, so there is nothing to set up twice.

If your team already runs Lens, send your first trace. Choose your framework, give the agent a name, and run the example.

For a team, deploy Lens on a server or Kubernetes, or add it to your LiteLLM dashboard. If Lens already runs, connect that deployment to your gateway. 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 or Codex. Open Traces to see the recorded activity.

Once traces are available, run an investigation or use the API reference.

Use Model optimizations 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.

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.

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.

Feature guides​

The guides cover setup, a first useful result, and what to check when no results appear. Screenshots show demo data in the Lens UI preview

TaskGuide
Inspect an agent runTraces and agents
Review recurring problemsFindings and Investigations
Flag individual runsAlerts
Understand task usage and spendProfiles
Save examples for testingDatasets
Catch regressions in agent changesEvals
Compare model quality, cost, and latencyModel optimizations
Send findings or alerts to a channelSlack notifications
Let a coding agent read LensMCP connectors
LiteLLM Enterprise
SSO/SAML, audit logs, spend tracking, multi-team management, and guardrails, built for production.
Learn more →