Airsc is free for everyone. If it helps you, support it with $2–$20.

Support
PluginCautionTesting & debuggingSome setup

langsmith-claude-code-plugins

langchain-ai · langchain-ai/langsmith-claude-code-plugins

A Claude Code plugin that traces conversations, tool calls, subagent runs, and context compaction to LangSmith.

LangSmith plugins for Claude Code

73 stars15License: MITUpdated 12 days ago0 opens

Preview

▍

What you can do with it

  • Review every tool call Claude Code made in a session in LangSmith
  • Debug why a subagent behaved unexpectedly
  • Monitor agent activity across a team

Safety check

Caution

Usable, but read the notes first.

  • ●Installer downloads a remote script and pipes it to the shell.README.md

Automated scan of the repo files. Always review code you run.

From the README

LangSmith Tracing Plugin for Claude Code

A Claude Code plugin that traces conversations, tool calls, subagent executions, and context compaction to LangSmith.

Setting up the LangSmith Gateway? Start with the required LangSmith CLI installation and browser login, then install and enable the separate langsmith-gateway plugin. The tracing plugin documented below does not require the LangSmith CLI and is optional when using the gateway.

Prerequisites

  • Node.js v18+, needed only when the plugin carries no build for your machine

Installation

Claude Code installs and manages the plugin for you, and the plugin carries its own macOS builds so there is nothing to download separately.

As a Claude Code plugin

From within Claude Code, run:

/plugin marketplace add langchain-ai/langsmith-claude-code-plugins
/plugin install langsmith-tracing@langsmith-claude-code-plugins
/reload-plugins

The hooks run a macOS build carried inside the plugin whenever one matches your machine, so on a Mac there is nothing to download and nothing to keep up to date beyond the plugin itself. Anywhere else, such as Linux and Windows, the same integration runs on the Node on your PATH. Either way the plugin shows up in /plugin with its name, version and enabled state, which is how you check that tracing is active.

To update, refresh the marketplace from within Claude Code:

/plugin marketplace update langsmith-claude-code-plugins

then move the install onto the new version from your shell:

claude plugin update langsmith-tracing@langsmith-claude-code-plugins

and restart Claude Code.

The marketplace update on its own only refreshes the catalog clone. Your install stays pinned to the version directory it was installed from, so the hooks keep running the old bundle until claude plugin update moves it.

To skip both steps next time, run /plugin, open Marketplaces → langsmith-claude-code-plugins and choose Enable auto-update. Third-party marketplaces have it off by default; enabling it updates the marketplace and its installed plugins together.

As a Claude Cowork plugin

Claude Cowork runs Claude Code in a sandboxed VM, thus the plugin needs to be added separately.

  1. Allow network egress for LANGSMITH_CC_ENDPOINT (eg. https://api.smith.langchain.com) or for all domains
  2. Add langchain-ai/langsmith-claude-code-plugins marketplace in Customize > Personal Plugins (+) > Create Plugin > Add Marketplace
  3. Edit each of the Claude Code hooks by prepending LangSmith Claude Code environment variables to command of every hook. Watch video to see step-by-step.

https://github.com/user-attachments/assets/1d44b30f-e0a8-4173-b60b-97a2d1fb95c5

[!IMPORTANT] Make sure that 'Allow network egress' is either enabled for all domains or enabled for LANGSMITH_CC_ENDPOINT, otherwise Cowork might freeze.

From source (development)

pnpm install
pnpm build
claude --plugin-dir /path/to/langsmith-claude-code-plugins

Setting environment variables

Option 1: Claude Code settings file (recommended)

Add the following to a .claude/settings.local.json file in your project folder or ~/.claude/settings.json globally:

{
  "env": {
    "TRACE_TO_LANGSMITH": "true",
    "CC_LANGSMITH_API_KEY": "lsv2_pt_...",
    "CC_LANGSMITH_PROJECT": "my-project"
  }
}

Option 2: Export to shell

Add to your ~/.zshrc, ~/.bashrc, or ~/.bash_profile:

export TRACE_TO_LANGSMITH="true"
export CC_LANGSMITH_API_KEY="lsv2_pt_..."
export CC_LANGSMITH_PROJECT="my-project"

Getting your LangSmith API key

  1. Go to smith.langchain.com
  2. Sign in or create an account
  3. Navigate to Settings → API Keys
  4. Click Create API Key
  5. Copy the key (starts with lsv2_pt_...)

What gets traced

With full tracing (the default), each LLM run includes:

  • Inputs: accumulated conversation messages
  • Outputs: assistant response content
  • Metadata: ls_provider: "anthropic", ls_model_name, ls_invocation_params (model, plus effort/service_tier when the transcript records them), token usage

In full mode, all runs (LLM, tool, turn, subagent) automatically include identity metadata so you can attribute traces in LangSmith:

  • anthropic_user_id: read from the userID field in ~/.claude.json (the Claude Code installation's stable hashed user ID). Omitted if the file is missing or unreadable.
  • local_username: the local OS username from os.userInfo().

To override either field, supply your own value via CC_LANGSMITH_METADATA since user-supplied keys always win.

Tool runs include the tool name, inputs, and output content. Skill tool runs additionally set ls_skill_name to the invoked skill's name, read from the tool's skill input, so per-skill usage is queryable in run stats.

Interrupted turns (where the user cancels mid-response) are marked with status "interrupted" in LangSmith.

Opening the current session in LangSmith

Run /langsmith-tracing:trace to get a link to this conversation's trace. It does not start a model turn or change any settings. When you trace to several projects, you get one labelled link per project.

  • A new thread is empty until a traced prompt finishes uploading.
  • Changing projects does not move older traces.
  • These are not public share links; recipients need access to the project.
  • If the lookup fails, search LangSmith for the session ID it prints.

Muting a thread

Muting is off by default unless configured below. With tracing enabled, use these argument-free plugin commands:

  • /langsmith-tracing:mute: omit this thread's input/output content and unsafe metadata.
  • /langsmith-tracing:unmute: restore full tracing for subsequent turns.

Claude Code namespaces

View source on GitHub