Install
openclaw plugins install clawhub:openclaw-langsmith@latestLangSmith tracing plugin for OpenClaw. Automatic observability for agent turns, tool calls, and LLM invocations.
openclaw plugins install clawhub:openclaw-langsmith@latestLangSmith tracing plugin for OpenClaw. Automatically traces agent turns, tool calls, and LLM invocations to LangSmith for observability, debugging, and cost tracking.
fetch and crypto.randomUUID()lsv2_pt_...)cd ~/.openclaw/extensions
git clone https://github.com/joshuaswarren/openclaw-langsmith.git
cd openclaw-langsmith
npm install && npm run build
The gateway needs the API key in its environment. Choose your platform:
Edit ~/Library/LaunchAgents/ai.openclaw.gateway.plist and add inside EnvironmentVariables:
<key>LANGSMITH_API_KEY</key>
<string>lsv2_pt_your_key_here</string>
Edit ~/.config/systemd/user/openclaw-gateway.service and add to the [Service] section:
Environment="LANGSMITH_API_KEY=lsv2_pt_your_key_here"
Or create an environment file at ~/.config/openclaw/env:
LANGSMITH_API_KEY=lsv2_pt_your_key_here
Then reference it in the service file:
EnvironmentFile=%h/.config/openclaw/env
Add to your docker-compose.yml or pass via -e:
environment:
- LANGSMITH_API_KEY=lsv2_pt_your_key_here
{
"plugins": {
"allow": ["openclaw-langsmith"],
"entries": {
"openclaw-langsmith": {
"enabled": true,
"config": {
"langsmithApiKey": "${LANGSMITH_API_KEY}",
"projectName": "openclaw"
}
}
}
}
}
macOS:
launchctl kickstart -k gui/$(id -u)/ai.openclaw.gateway
Linux:
systemctl --user restart openclaw-gateway
Docker:
docker compose restart openclaw-gateway
Verify (all platforms):
tail -f ~/.openclaw/logs/gateway.log | grep langsmith
# Should see: [langsmith] langsmith tracing active
| Option | Type | Default | Description |
|---|---|---|---|
langsmithApiKey | string | $LANGSMITH_API_KEY | LangSmith API key |
langsmithEndpoint | string | https://api.smith.langchain.com | API endpoint |
projectName | string | openclaw | LangSmith project name |
traceAgentTurns | boolean | true | Trace agent turns |
traceToolCalls | boolean | true | Trace tool calls |
traceEngramLlm | boolean | true | Trace engram LLM calls |
batchIntervalMs | number | 1000 | Batch flush interval (ms) |
batchMaxSize | number | 20 | Max operations before flush |
debug | boolean | false | Enable debug logging |
Traces are automatically tagged for easy filtering in LangSmith:
| Tag | Description | Example |
|---|---|---|
cron | Cron job runs | Filter all scheduled jobs |
discord | Discord messages | Filter Discord conversations |
slack | Slack messages | Filter Slack conversations |
telegram | Telegram messages | Filter Telegram conversations |
job:<id> | Specific cron job | job:96b7720d-02b1-4373-8846-33306c9913fc |
name:<name> | Cron job name | name:X Bookmarks → Insights pipeline |
channel:<id> | Discord channel | channel:1467253309348909241 |
guild:#<name> | Discord guild | guild:#proj-deckard |
Hooks into before_agent_start and agent_end. Creates LangSmith runs with:
Hooks into before_tool_call and after_tool_call. Tool runs are nested under the parent agent run using LangSmith's trace_id and dotted_order for proper hierarchy.
The engram memory plugin emits LlmTraceEvent objects via globalThis.__openclawEngramTrace. This plugin subscribes and creates LLM runs with:
npm install
npm run build # Build with tsup
npm run dev # Watch mode
MIT © Joshua Warren