Skip to main content
OpenTelemetry is a telemetry data source. Instead of Switch Trust scanning something you own, your agent sends Switch Trust its traces as it runs. Switch Trust turns them into the agent’s sessions, turns, and cost. If your agent already uses OpenTelemetry, or you can’t add the Switch Trust SDK to it, you can connect it by setting environment variables, with no code change. To open this page, go to Settings, then Data sources, and select OpenTelemetry.
Setting up the OpenTelemetry data source requires the Editor role or higher. With a lower role, the OpenTelemetry card can’t be selected.

Supported frameworks

Switch Trust reads traces from the following frameworks:
  • LangChain, instrumented with OpenInference. Install openinference-instrumentation-langchain alongside the OpenTelemetry SDK and exporter. Switch Trust recognizes LangChain traces by their OpenInference instrumentation, so LangChain traces from other instrumentation libraries aren’t read.
  • Claude Code, using its built-in telemetry. There is nothing to install.

Connect your agent

The Setup tab gives you the values to use, with your own endpoint already filled in.
1

Get your connection details

You need two values: your OTLP endpoint and a Switch Trust API token.
  • OTLP endpoint. The Setup tab shows the exact URL to use. Copy it from there. It is a base URL, ending in /agent/otel, and your OpenTelemetry SDK adds the path for each signal itself.
  • API token. Use an existing token, or create one now if you don’t have one. Tokens are managed under Settings, then API keys, and the Setup tab has a Create one now shortcut. The token needs the Editor role or higher. A Viewer token is rejected.
2

Set your environment variables

On the Setup tab, choose your agent’s framework under Framework. Then set the variables it shows in your agent’s environment before you start the agent. Replace the following placeholders with your own values:
  • <service> - A name for the service that runs the agent
  • <agent> - The agent’s name (see Name your agent)
  • <apikey> - The API token from the first step
Already running an OpenTelemetry Collector? Add Switch Trust as an additional OTLP exporter in your Collector instead. You don’t have to move your existing stack.
3

Run your agent

Start your agent as you normally would. Switch Trust starts reading as soon as the first traces arrive, and you don’t need to create the agent in Switch Trust first.

Name your agent

Switch Trust attributes each trace to an agent, and cost, spend caps, and burn rate are all tracked per agent. Set the agent’s name with gen_ai.agent.name in OTEL_RESOURCE_ATTRIBUTES, as the variables above do. If you also scan the agent’s code, use the same name the scan gave the agent, which is the Name on the agent’s Details card. When the names match, the traces and the scan results land on one agent. When they don’t, Switch Trust lists two agents and splits the agent’s cost and history between them. Set the name before the agent first sends traces, because Switch Trust can’t merge the two agents afterward. If you don’t set gen_ai.agent.name, Switch Trust names the agent after the nearest agent in the trace. For Claude Code, or when the trace doesn’t have one, it uses OTEL_SERVICE_NAME instead.

What you see

Once traces arrive, the agent appears in Agents. Its sessions appear on its Sessions tab and its spending on its cost cards. Each turn also appears on the Live page. Switch Trust prices each model call from Model pricing. If the agent calls a model Switch Trust has no list price for, such as a model served from Hugging Face, its usage counts as $0 until you set a price for it. The OpenTelemetry data source has no Scans tab, and its card doesn’t show a Connected status. To confirm that traces are arriving, open the agent and check its Sessions tab.
Connect each agent through either OpenTelemetry or the Switch Trust SDK, not both. An agent that reports through both is recorded twice for every call, so its cost is counted twice.

Next steps

Live traffic

Watch your agents’ turns as they happen

Connect another data source

Add a repository or a cloud platform to widen your inventory