Claude Code는 현재까지 가장 인상적이고 유용한 AI 코딩 도구 중 하나입니다. Claude Code는 모니터링과 관찰 가능성을 위한 이벤트를 발생시킵니다. LangSmith는 이러한 이벤트를 수집하고 표시하여 Claude Code가 내부적으로 수행하는 작업에 대한 전체 상세 로그를 제공할 수 있습니다.

빠른 시작

Claude Code를 실행하는 환경에서 다음 환경 변수를 설정하여 LangSmith 추적을 Claude Code와 통합할 수 있습니다.
# Enables Claude Code to emit OTEL events
export CLAUDE_CODE_ENABLE_TELEMETRY=1

# Sets the output format to use Open Telemetry Protocol
export OTEL_LOGS_EXPORTER=otlp

# LangSmith ingests JSON format events
export OTEL_EXPORTER_OTLP_LOGS_PROTOCOL=http/json

# Claude Code Logs are translated to Spans by LangSmith
export OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=https://api.smith.langchain.com/otel/v1/claude_code

# Pass your API key and desired tracing project through headers
export OTEL_EXPORTER_OTLP_HEADERS="x-api-key=<api-key>,Langsmith-Project=<project-name>"

# Set this to true in order to log the input user prompts
export OTEL_LOG_USER_PROMPTS=1

# Once these are set, start Claude Code, and events will be traced to LangSmith
claude
Claude Code는 사용량 모니터링을 위해 open telemetry 표준 이벤트를 발생시키지만, 여기에는 LLM으로 전송되는 실제 prompt와 message가 포함되지 않습니다.
LangSmith를 자체 호스팅하는 경우, base endpoint를 LangSmith api endpoint로 교체하고 /api/v1을 추가하세요. 예: OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=https://ai-company.com/api/v1/otel/v1/claude_code
Claude Code Trace
Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.
I