Skip to main content
The LangSmith tracing plugin sends your Claude Code conversations to LangSmith so you can see what the agent did. Each message becomes a trace, and a session’s messages are grouped into a thread.

Prerequisites

  • Claude Code installed.
  • A LangSmith account.
  • Node.js 20 or later on Windows and Linux. On macOS the plugin runs its own build and does not need Node.js.

Install the plugin

Run these commands inside Claude Code:
Auto-update is off for this marketplace by default. To turn it on, run /plugin and open Marketplaces. To install the plugin for everyone, see Deploy to your organization. For more on installing plugins, see Install plugins in the Claude Code docs.

Sign in

Sign in once with the LangSmith CLI. See Install the LangSmith CLI if you do not have it yet.
If you use the CLI sign-in and have more than one profile, set profile in your config file to the one the plugin should use. Your own api_key ignores this setting, but a generic LANGSMITH_API_KEY is not used as a fallback while profile is set. To use an API key instead, add it to ~/.claude/langsmith.json:
If more than one credential is set, the plugin uses the first one it finds:
  1. The plugin’s own key from api_key or CC_LANGSMITH_API_KEY.
  2. Your langsmith auth login sign-in.
  3. A generic LANGSMITH_API_KEY from your environment.
A CLI sign-in acts as you so your workspace role needs permission to write traces. You may get a 403 if you switched from a tracing API key (lsv2_tr_...) to the CLI sign-in since tracing keys can always write traces whatever your role is. If that happens ask your admin to give you a role that can write traces such as Workspace User and check that no ABAC deny policy on the project blocks it. Tracing stops when your sign-in expires or your key is rejected, and turns from that gap are never uploaded. Claude Code reminds you in the chat until you fix it. Admins can also require a working sign-in for every prompt.

Turn on tracing

Tracing is off until you turn it on in ~/.claude/langsmith.json, unless your admin already turned it on with a managed file. In an agent-based workspace, send traces to an agent with agent_id:
In a project-based workspace, use the legacy project setting instead:
A project can override these settings with <project>/.claude/langsmith.json or <project>/langsmith-plugins.json. A cloned repository can use them to turn tracing on and send your conversations to someone else’s server. Before you trust a repository, review those files along with .claude/settings.json and .claude/settings.local.json.
Send a message and open your agent or project in LangSmith. Run /langsmith-tracing:trace to get a link to the current conversation’s trace.

Deploy to your organization

Admins can install the plugin for everyone and control how it traces from one place.

Install for everyone

Use Claude Code’s managed settings to install the plugin on every machine. For the setup, see Manage Claude Code plugins for your organization.

Lock settings

An admin can lock tracing settings for every user with a managed file at ~/.langsmith-plugins/managed.json in each user’s home folder. The Claude Code, Cursor, and Codex plugins all read this file, and its settings override the user’s own config files and environment variables.
Set workspace_id as well when your users sign in with the LangSmith CLI. Each user’s sign-in may default to a different workspace, so setting it here keeps everyone’s traces in one place. API keys ignore this setting so use one scoped to a workspace. The managed file works on macOS and Linux. The plugin only trusts it when:
  • Root owns the file and its folder.
  • No other user can write to either.
  • Neither is a symlink.
If the file exists but fails these checks, tracing stops and the user sees a message to contact their admin. Locking a setting also locks the settings tied to it, so users cannot route traces around the lock. For example, locking agent_id also stops users from sending traces to a project with project. Admins usually install the file on each machine with a mobile device management (MDM) tool such as Jamf or Microsoft Intune. For every setting you can lock, see the plugin settings guide.
Run this as root for each user, with USER_HOME set to that user’s home folder:
On Linux, use root:root instead of root:wheel. For the full script, see Set it up on macOS.

Require a working sign-in

Strict auth blocks every prompt until the user’s sign-in or key works, so no session goes untraced. It is off by default and has no effect while tracing is off. To turn it on for everyone, set strict_auth to true in the managed file.
Strict auth also blocks non-interactive runs such as claude -p in CI. Leave it off for automated runs unless a failed sign-in should stop the job.

Hide a conversation

Run /langsmith-tracing:mute inside Claude Code to keep a conversation’s content out of LangSmith, and /langsmith-tracing:unmute to turn it back on. The confirmation appears as a prompt blocked by a hook, because that is how Claude Code shows a plugin’s reply. To mute every conversation by default, set defaultMuted to true.

Secret redaction

The plugin strips secrets on your machine before anything is uploaded, so they never reach LangSmith or a replica. Redaction is on by default. It catches provider API keys, JSON Web Tokens, and PEM private keys, along with common patterns such as API_KEY=<value> or a password in a URL. Each match is replaced with [SECRET_DETECTED]. For the full rule list, see Redact secrets from traces. Redaction only matches known credential shapes, so treat it as a safety net rather than a guarantee. Run names, tags, and attachments skip it, and a redacted trace still holds your prompts and file contents. Limit who can read the tracing project. To turn redaction off or add your own patterns, see the plugin settings.

Settings

Each setting has a config file key and an environment variable. The environment variable wins when both are set. For every setting, see the plugin settings.

Other examples

The plugin’s Advanced configuration guide has worked examples for:

Troubleshooting

  • No traces: Check that the plugin is enabled in /plugin and that tracing is on.
  • Tracing is paused: Run langsmith auth login again or replace the rejected API key.
  • Tracing is paused after a 403: Your sign-in or API key might not have access to the agent, project or workspace. Look through ~/.claude/state/langsmith_engine/worker.log and ~/.claude/state/hook.log for the details.
  • Still stuck: Set CC_LANGSMITH_DEBUG=true and check ~/.claude/state/hook.log.
For more fixes, see When nothing shows up.