- From the Claude Platform: The Claude Platform sends traces directly from Anthropic’s servers. You configure it in the Claude Console, with no changes to your agent code.
- From your agent: Your agent sends the traces, in one of two ways:
- Claude SDKs: The Claude SDKs emit OpenTelemetry (OTel) spans, and an OTel exporter library sends them to LangSmith.
- LangSmith SDK wrapper: You wrap the Anthropic client with the LangSmith SDK (Python or TypeScript). You can combine the traces with
@traceablespans for the rest of your code in a single trace.
Tracing from the Claude Platform and the Claude SDKs is in public beta.
In an agent-based workspace, create an agent once before sending traces. Use agent addressing to select its identifier and environment. If an integration requires
project_name, use the selected environment’s tracer_session_name as a compatibility value.Trace from the Claude Platform
The Claude Platform exports OTel traces of your Claude Managed Agents sessions and Messages API requests. It sends them to a destination, an OTel endpoint that you register in the Claude Console. You can add LangSmith as a destination and view these traces without changing your agent code. For details on destinations and delivery, see Use OpenTelemetry with the Claude API in the Anthropic docs. Before you begin, you need:- The admin role, or an equivalent permission, in your Claude Console organization. Without it, you cannot view or manage destinations.
- A LangSmith API key. You can use a personal access token, or a service key when you want tracing to be independent of your user account. To create a key, see Create an account and API key.
- In an agent-based workspace, the selected agent environment’s
tracer_session_name, which goes in the destination’s Project field. - For self-hosted LangSmith, an endpoint that the Claude Platform can reach: HTTPS on port 443, at a hostname that resolves to a public IP address.
Step 1. Add LangSmith as a destination
To add a destination:- In the Claude Console, open the OpenTelemetry settings page of your organization and click Add destination.
- In the Provider drop-down, select LangSmith. The form changes to show the LangSmith fields.
- Complete the fields:
- Name: (Optional) A label for the destination, such as
LangSmith. - Region: The region of your LangSmith deployment: US, EU, APAC, or US on AWS. For self-hosted LangSmith, select Self-hosted. In LangSmith URL, enter your LangSmith API URL (
LANGSMITH_ENDPOINT) plus/otel. For the URL on each deployment type, see Find your OTLP endpoint. - API key: Your LangSmith API key.
- Project: The environment’s
tracer_session_nameto send traces to. Set it explicitly in an agent-based workspace. If omitted, the integration usesdefault. - LangSmith workspace ID: (Optional) The ID of the LangSmith workspace to send traces to. If you leave it empty, traces go to the workspace that the API key belongs to. Organization-scoped service keys require it. To find the ID, see Create an account and API key.
- Content mode: Select Full content to include prompts and responses in the spans. With Metadata only, spans omit the input and output content.
- Workspaces: The Claude workspaces that send traces to this destination: All, Selected, or All except. For details on each option, see Choose workspaces for a destination in the Anthropic docs.
- Name: (Optional) A label for the destination, such as
- Click Add destination.
x-api-key: The API key.Langsmith-Project: The Project, if you set one.X-Tenant-Id: The LangSmith workspace ID, if you set one.
Step 2. Check that traces arrive
To check the setup:- Send a Messages API request or run a Claude Managed Agents session in a Claude workspace that uses the destination.
- On the Claude Console OpenTelemetry settings page, check that the Delivery column of the destination shows Healthy. This can take about a minute.
- In LangSmith, select the agent and environment whose
tracer_session_nameyou entered in the Project field.
Troubleshoot delivery
If the Delivery column on the Claude Console OpenTelemetry settings page shows Failing, hold the pointer over it to see the last error:
For other errors, see Delivery errors in the Anthropic docs.
If the Delivery column shows Disabled, hold the pointer over it to see why. For example, the Claude Platform disables a destination when all deliveries fail for 24 hours or when the endpoint sends a redirect, and it drops spans while the destination is disabled. See Delivery and health in the Anthropic docs.
Trace from your agent
Use one of these methods when your agent should send the traces. To trace your Anthropic calls together with the rest of your code in a single trace, use the LangSmith SDK wrapper.Use the Claude SDKs
The Claude SDKs emit OTel spans in your agent for each request that they send and for each tool use that the tool runner runs. An OTel exporter library sends the spans to LangSmith. For details on the SDK options and the spans that the SDKs emit, see Set up SDK tracing in the Anthropic docs. To send Claude SDK spans to LangSmith:- Install or upgrade the Claude SDK and register a tracer provider.
-
Configure an OTel exporter with your LangSmith API URL (
LANGSMITH_ENDPOINT) plus/otelas the base endpoint. For the URL on each deployment type, see Find your OTLP endpoint. Set the following request headers:x-api-key: Your LangSmith API key.Langsmith-Agent-Id: The registered agent identifier.Langsmith-Agent-Environment: The environment, such aslocal.X-Tenant-Id: (Optional) The ID of the LangSmith workspace to send traces to. Without this header, traces go to the workspace that the API key belongs to. Organization-scoped service keys require it.
For more information on exporter setup, see Trace a non-LangChain agent. - (Optional) By default, the Claude SDKs record metadata only. To include prompts and responses in the spans, set the content mode. See Configure the SDK in the Anthropic docs.
Use the LangSmith SDK wrapper
The Anthropic wrapper methods in Python (wrap_anthropic) and TypeScript (wrapAnthropic) wrap your Anthropic client to log traces automatically. With the wrapper, LangSmith renders messages, including tool calls and multimodal content blocks, in a readable format. The wrapper works alongside the @traceable decorator (Python) or traceable function (TypeScript), so you can trace your Anthropic calls with the wrapper and trace other parts of your agent with the decorator or function.
Set the
LANGSMITH_TRACING environment variable to 'true' to log traces to LangSmith, even when you use wrap_anthropic or wrapAnthropic. This lets you toggle tracing on and off without changing your code.Also set the LANGSMITH_API_KEY environment variable to your API key. To create a key, see Create an account and API key.The wrapper sends traces through the LangSmith SDK, not OTLP, so set LANGSMITH_ENDPOINT to your LangSmith API URL without /otel.LANGSMITH_ENDPOINT defaults to https://api.smith.langchain.com (GCP US). Set it to your data plane URL on BYOC, your instance URL on self-hosted, or the API URL for your region on other Cloud regions.If your LangSmith API key is linked to multiple workspaces, set the LANGSMITH_WORKSPACE_ID environment variable to specify which workspace to use.Set LANGSMITH_AGENT_ID and LANGSMITH_AGENT_ENVIRONMENT to the registered agent and environment. See Configure tracing for the agent.wrapAnthropic wrapper, see Trace Claude Managed Agents.
Connect these docs to your agent of choice via MCP for real-time answers.

