Skip to main content

Send your first trace

Connect your agent​

Point your agent's OpenTelemetry OTLP/HTTP exporter to LiteLLM:

SettingValue
Trace endpointhttps://<your-litellm-proxy>/v1/traces
HTTP headerAuthorization: Bearer <your-litellm-key>

Use a LiteLLM key to authenticate. Record the agent's task, steps, tool calls, inputs, and final answer. Lens uses this content to check what happened.

For a working example, use DeepLite. Set LITELLM_DEV_BASE=https://<your-litellm-proxy>/v1/traces and LITELLM_DEV_KEY=<your-litellm-key> in its .env file, then run the agent.

Configure the exporter​

Use your existing model configuration. Set the trace destination once, then choose an integration from the sidebar. Replace research_agent with your agent's name.

export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="https://<your-litellm-proxy>/v1/traces"
export OTEL_EXPORTER_OTLP_TRACES_HEADERS="Authorization=Bearer <your-litellm-key>"
export OTEL_EXPORTER_OTLP_PROTOCOL="http/protobuf"
export OTEL_METRICS_EXPORTER="none"
export OTEL_LOGS_EXPORTER="none"

Open an integration guide from the sidebar for dependencies, configuration, and runnable simple-agent and swarm examples. The examples send model calls and traces to your gateway. If your app already configures a tracer provider, keep it and point its exporter at the destination above.

To record personal coding sessions, follow the Claude Code and Codex setup.

View your first trace​

Open Lens > Traces. Select a time range that includes your run, then open it. For the examples above, look for research_agent. The same name is available under Agent when creating an investigation. Select a step to read its input, output, and attributes.

A research_agent trace with its question, model call, and final answer.

Check that you can see the task, tool results, and final answer. If these are missing, update your agent's instrumentation before running an investigation.

LiteLLM Enterprise
SSO/SAML, audit logs, spend tracking, multi-team management, and guardrails, built for production.
Learn more →