Community코딩 & 개발github.com

langsmith-fetch

LangChain 및 LangGraph 에이전트의 실행 추적을 LangSmith Studio에서 가져와 디버깅합니다. 에이전트 동작 디버깅, 오류 조사, 도구 호출 분석, 메모리 작업 확인 또는 에이전트 성능 검사 시 사용하세요. langsmith-fetch CLI가 설치되어 있어야 합니다.

langsmith-fetch란 무엇인가요?

LangSmith Fetch는 LangChain과 LangGraph로 구축된 에이전트의 실행 추적을 LangSmith Studio에서 직접 터미널로 가져와 디버깅할 수 있는 전문 기술입니다. 개발자가 에이전트 동작을 분석하고, 오류를 진단하며, 도구 호출 순서, 메모리 작업, 토큰 사용량 및 실행 시간을 검사할 수 있도록 도와줍니다. `langsmith-fetch` CLI 도구를 기반으로 하며, 환경 변수(LANGSMITH_API_KEY, LANGSMITH_PROJECT) 설정이 필요합니다. 최근 활동 퀵 디버그, 특정 추적 심층 분석, 디버그 세션 내보내기, 오류 감지 등 4가지 주요 워크플로우를 제공하며, pretty/JSON/raw 형식을 지원합니다. 이 기술은 Claude Code, Cursor, Codex 등 다양한 AI 코딩 에이전트와 함께 사용할 수 있도록 설계되었으며, 특히 복잡한 LangChain/LangGraph 애플리케이션을 구축하고 유지보수하는 개발자에게 매우 유용합니다.

지원 대상✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ComposioHQ/awesome-claude-skills/tree/master/langsmith-fetch

Installed? Explore more 코딩 & 개발 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

LangSmith Fetch - 에이전트 디버깅 기술

LangChain 및 LangGraph 에이전트의 실행 추적을 LangSmith Studio에서 직접 터미널로 가져와 디버깅합니다.

이 기술을 사용해야 하는 경우

사용자가 다음을 언급할 때 자동으로 활성화됩니다:

  • 🐛 "에이전트를 디버깅해 줘" 또는 "무슨 문제가 있었지?"
  • 🔍 "최근 추적을 보여 줘" 또는 "무슨 일이 일어났어?"
  • ❌ "오류를 확인해 줘" 또는 "왜 실패했어?"
  • 💾 "메모리 작업을 분석해 줘" 또는 "LTM 확인"
  • 📊 "에이전트 성능을 검토해 줘" 또는 "토큰 사용량 확인"
  • 🔧 "어떤 도구가 호출되었어?" 또는 "실행 흐름을 보여 줘"

사전 요구 사항

1. langsmith-fetch 설치

pip install langsmith-fetch

2. 환경 변수 설정

export LANGSMITH_API_KEY="your_langsmith_api_key"
export LANGSMITH_PROJECT="your_project_name"

설정 확인:

echo $LANGSMITH_API_KEY
echo $LANGSMITH_PROJECT

핵심 워크플로우

워크플로우 1: 최근 활동 퀵 디버그

사용자가 묻는 경우: "방금 무슨 일이 있었어?" 또는 "내 에이전트를 디버깅해 줘"

실행:

langsmith-fetch traces --last-n-minutes 5 --limit 5 --format pretty

분석 및 보고:

  1. ✅ 찾은 추적 수
  2. ⚠️ 오류 또는 실패 항목
  3. 🛠️ 호출된 도구
  4. ⏱️ 실행 시간
  5. 💰 토큰 사용량

응답 형식 예시:

지난 5분 동안 3개의 추적을 찾았습니다:

추적 1: ✅ 성공
- 에이전트: memento
- 도구: recall_memories, create_entities
- 지속 시간: 2.3초
- 토큰: 1,245

추적 2: ❌ 오류
- 에이전트: cypher
- 오류: "Neo4j 연결 시간 초과"
- 지속 시간: 15.1초
- 실패 지점: search_nodes 도구

추적 3: ✅ 성공
- 에이전트: memento
- 도구: store_memory
- 지속 시간: 1.8초
- 토큰: 892

💡 문제 발견: 추적 2가 Neo4j 시간 초과로 실패했습니다. 데이터베이스 연결을 확인하는 것이 좋습니다.

워크플로우 2: 특정 추적 심층 분석

사용자가 제공하는 경우: 추적 ID 또는 "그 오류를 조사해 줘"라고 말할 때

실행:

langsmith-fetch trace <trace-id> --format json

JSON 분석 및 보고:

  1. 🎯 에이전트가 수행하려던 작업
  2. 🛠️ 호출된 도구 (순서대로)
  3. ✅ 도구 결과 (성공/실패)
  4. ❌ 오류 메시지 (있는 경우)
  5. 💡 근본 원인 분석
  6. 🔧 제안된 수정 사항

응답 형식 예시:

심층 분석 - 추적 abc123

목표: 사용자가 "Neo4j에서 모든 프로젝트를 찾아줘"라고 요청

실행 흐름:
1. ✅ search_nodes(query: "projects")
   → 24개의 노드 발견

2. ❌ get_node_details(node_id: "proj_123")
   → 오류: "노드를 찾을 수 없음"
   → 이것이 실패 지점입니다

3. ⏹️ 실행 중단

근본 원인:
search_nodes 도구가 더 이상 데이터베이스에 존재하지 않는 노드 ID를 반환했습니다.
최근 삭제로 인한 것으로 보입니다.

제안된 수정 사항:
1. get_node_details 도구에 오류 처리 추가
2. 검색 결과에서 삭제된 노드 필터링
3. 캐시 무효화 전략 업데이트

토큰 사용량: 1,842 토큰 ($0.0276)
실행 시간: 8.7초

워크플로우 3: 디버그 세션 내보내기

사용자가 말하는 경우: "이 세션을 저장해 줘" 또는 "추적을 내보내 줘"

실행:

# 타임스탬프가 있는 세션 폴더 생성
SESSION_DIR="langsmith-debug/session-$(date +%Y%m%d-%H%M%S)"
mkdir -p "$SESSION_DIR"

# 추적 내보내기
langsmith-fetch traces "$SESSION_DIR/traces" --last-n-minutes 30 --limit 50 --include-metadata

# 스레드(대화) 내보내기
langsmith-fetch threads "$SESSION_DIR/threads" --limit 20

보고:

✅ 세션을 성공적으로 내보냈습니다!

위치: langsmith-debug/session-20251224-143022/
- 추적: 42개 파일
- 스레드: 8개 파일

이제 다음을 수행할 수 있습니다:
1. 개별 추적 파일 검토
2. 팀과 폴더 공유
3. 외부 도구로 분석
4. 향후 참조를 위해 보관

세션 크기: 2.3 MB

워크플로우 4: 오류 감지

사용자가 묻는 경우: "오류를 보여 줘" 또는 "무엇이 실패하고 있어?"

실행:

# 최근 추적 가져오기
langsmith-fetch traces --last-n-minutes 30 --limit 50 --format json > recent-traces.json

# 오류 검색
grep -i "error\|failed\|exception" recent-traces.json

분석 및 보고:

  1. 📊 발견된 총 오류 수
  2. ❌ 오류 유형 및 빈도
  3. 🕐 오류 발생 시간
  4. 🎯 실패한 에이전트/도구
  5. 💡 일반적인 패턴

응답 형식 예시:

오류 분석 - 지난 30분

총 추적: 50
실패한 추적: 7 (14% 실패율)

오류 분석:
1. Neo4j 연결 시간 초과 (4회 발생)
   - 에이전트: cypher
   - 도구: search_nodes
   - 최초 발생: 14:32
   - 마지막 발생: 14:45
   - 패턴: 최대 부하 시간에 발생

2. 메모리 저장 실패 (2회 발생)
   - 에이전트: memento
   - 도구: store_memory
   - 오류: "Pinecone 속도 제한 초과"
   - 발생 시간: 14:38, 14:41

3. 도구를 찾을 수 없음 (1회 발생)
   - 에이전트: sqlcrm
   - 시도된 도구: "export_report" (존재하지 않음)
   - 발생 시간: 14:35

💡 권장 사항:
1. Neo4j 시간 초과에 재시도 로직 추가
2. Pinecone에 속도 제한 구현
3. sqlcrm 도구 구성 수정

일반적인 사용 사례

사용 사례 1: "에이전트가 응답하지 않음"

사용자가 말하는 경우: "내 에이전트가 아무것도 안 해요"

단계:

  1. 추적이 있는지 확인:

    langsmith-fetch traces --last-n-minutes 5 --limit 5
    
  2. 추적이 없는 경우:

    • 추적이 비활성화되었을 수 있음
    • 환경 확인: LANGCHAIN_TRACING_V2=true
    • LANGCHAIN_API_KEY가 설정되었는지 확인
    • 에이전트가 실제로 실행되었는지 확인
  3. 추적이 있는 경우:

    • 오류 검토
    • 실행 시간 확인 (중단됨?)
    • 도구 호출이 완료되었는지 확인

사용 사례 2: "잘못된 도구 호출"

사용자가 말하는 경우: "왜 잘못된 도구를 사용했어요?"

단계:

  1. 특정 추적 가져오기
  2. 실행 시점의 사용 가능한 도구 검토
  3. 도구 선택에 대한 에이전트의 추론 확인
  4. 도구 설명/지침 검사
  5. 프롬프트 또는 도구 구성 개선 제안

사용 사례 3: "메모리가 작동하지 않음"

사용자가 말하는 경우: "에이전트가 기억을 못 해요"

단계:

  1. 메모리 작업 검색:

    langsmith-fetch traces --last-n-minutes 10 --limit 20 --format raw | grep -i "memory\|recall\|store"
    
  2. 확인:

    • 메모리 도구가 호출되었는가?
    • recall이 결과를 반환했는가?
    • 메모리가 실제로 저장되었는가?
    • 검색된 메모리가 사용되고 있는가?

사용 사례 4: "성능 문제"

사용자가 말하는 경우: "에이전트가 너무 느려요"

단계:

  1. 메타데이터와 함께 내보내기:

    langsmith-fetch traces ./perf-analysis --last-n-minutes 30 --limit 50 --include-metadata
    
  2. 분석:

    • 추적당 실행 시간
    • 도구 호출 지연 시간
    • 토큰 사용량 (컨텍스트 크기)
    • 반복 횟수
    • 가장 느린 작업
  3. 병목 지점 식별 및 최적화 제안


출력 형식 가이드

Pretty 형식 (기본값)

langsmith-fetch traces --limit 5 --format pretty

용도: 빠른 시각적 검사, 사용자에게 보여주기

JSON 형식

langsmith-fetch traces --limit 5 --format json

용도: 상세 분석, 구문 강조 검토

Raw 형식

langsmith-fetch traces --limit 5 --format raw

용도: 다른 명령어로 파이프, 자동화


고급 기능

시간 기반 필터링

# 특정 타임스탬프 이후
langsmith-fetch traces --after "2025-12-24T13:00:00Z" --limit 20

# 지난 N분 (가장 일반적)
langsmith-fetch traces --last-n-minutes 60 --limit 100

메타데이터 포함

# 추가 컨텍스트 가져오기
langsmith-fetch traces --limit 10 --include-metadata

# 메타데이터에는 다음이 포함됩니다: 에이전트 유형, 모델, 태그, 환경

동시 가져오기 (더 빠름)

# 대규모 내보내기 속도 향상
langsmith-fetch traces ./output --limit 100 --concurrent 10

문제 해결

"조건과 일치하는 추적이 없습니다"

가능한 원인:

  1. 해당 시간 범위 내 에이전트 활동 없음
  2. 추적이 비활성화됨
  3. 잘못된 프로젝트 이름
  4. API 키 문제

해결 방법:

# 1. 더 긴 시간 범위 시도
langsmith-fetch traces --last-n-minutes 1440 --limit 50

# 2. 환경 확인
echo $LANGSMITH_API_KEY
echo $LANGSMITH_PROJECT

# 3. 대신 스레드 가져오기 시도
langsmith-fetch threads --limit 10

# 4. 코드에서 추적이 활성화되었는지 확인
# 다음 항목 확인: LANGCHAIN_TRACING_V2=true

"프로젝트를 찾을 수 없습니다"

해결 방법:

# 현재 구성 보기
langsmith-fetch config show

# 올바른 프로젝트 설정
export LANGSMITH_PROJECT="correct-project-name"

# 또는 영구적으로 구성
langsmith-fetch config set project "your-project-name"

환경 변수가 유지되지 않음

해결 방법:

# 셸 구성 파일에 추가 (~/.bashrc 또는 ~/.zshrc)
echo 'export LANGSMITH_API_KEY="your_key"' >> ~/.bashrc
echo 'export LANGSMITH_PROJECT="your_project"' >> ~/.bashrc

# 셸 구성 다시 로드
source ~/.bashrc

모범 사례

1. 정기적인 상태 확인

# 변경 후 빠른 확인
langsmith-fetch traces --last-n-minutes 5 --limit 5

2. 체계적인 저장소

langsmith-debug/
├── sessions/
│   ├── 2025-12-24/
│   └── 2025-12-25/
├── error-cases/
└── performance-tests/

3. 결과 문서화

버그를 발견했을 때:

  1. 문제가 있는 추적 내보내기
  2. error-cases/ 폴더에 저장
  3. README에 무엇이 잘못되었는지 기록
  4. 팀과 추적 ID 공유

4. 개발과 통합

# 코드 커밋 전
langsmith-fetch traces --last-n-minutes 10 --limit 5

# 오류가 발견되면
langsmith-fetch trace <error-id> --format json > pre-commit-error.json

빠른 참조

# 가장 일반적인 명령어

# 빠른 디버그
langsmith-fetch traces --last-n-minutes 5 --limit 5 --format pretty

# 특정 추적
langsmith-fetch trace <trace-id> --format pretty

# 세션 내보내기
langsmith-fetch traces ./debug-session --last-n-minutes 30 --limit 50

# 오류 찾기
langsmith-fetch traces --last-n-minutes 30 --limit 50 --format raw | grep -i error

# 메타데이터 포함
langsmith-fetch traces --limit 10 --include-metadata

리소스


Claude를 위한 참고 사항

  • 명령어를 실행하기 전에 항상 langsmith-fetch가 설치되어 있는지 확인하세요
  • 환경 변수가 설정되었는지 확인하세요
  • 사람이 읽을 수 있는 출력에는 --format pretty를 사용하세요
  • 데이터를 구문 분석하고 분석해야 할 때는 --format json을 사용하세요
  • 세션을 내보낼 때는 체계적인 폴더 구조를 만드세요
  • 항상 명확한 분석과 실행 가능한 통찰력을 제공하세요
  • 명령어가 실패하면 구성 문제 해결을 도와주세요

버전: 0.1.0 저자: Ahmad Othman Ammar Adi 라이선스: MIT 저장소: https://github.com/OthmanAdi/langsmith-fetch-skill


Claude를 위한 참고 사항

  • 명령어를 실행하기 전에 항상 langsmith-fetch가 설치되어 있는지 확인하세요
  • 환경 변수가 설정되었는지 확인하세요
  • 사람이 읽을 수 있는 출력에는 --format pretty를 사용하세요
  • 데이터를 구문 분석하고 분석해야 할 때는 --format json을 사용하세요
  • 세션을 내보낼 때는 체계적인 폴더 구조를 만드세요
  • 항상 명확한 분석과 실행 가능한 통찰력을 제공하세요
  • 명령어가 실패하면 구성 문제 해결을 도와주세요

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

ably-automation

Automate Ably tasks via Rube MCP (Composio). Always search tools first for current schemas.

abstract-automation

Automate Abstract tasks via Rube MCP (Composio). Always search tools first for current schemas.

abuselpdb-automation

Automate Abuselpdb tasks via Rube MCP (Composio). Always search tools first for current schemas.

abyssale-automation

Automate Abyssale tasks via Rube MCP (Composio). Always search tools first for current schemas.

accelo-automation

Automate Accelo tasks via Rube MCP (Composio). Always search tools first for current schemas.

accredible-certificates-automation

Automate Accredible Certificates tasks via Rube MCP (Composio). Always search tools first for current schemas.

acculynx-automation

Automate Acculynx tasks via Rube MCP (Composio). Always search tools first for current schemas.

active-campaign-automation

Automate ActiveCampaign tasks via Rube MCP (Composio). Always search tools first for current schemas.

addresszen-automation

Automate Addresszen tasks via Rube MCP (Composio). Always search tools first for current schemas.

adobe-automation

Automate Adobe tasks via Rube MCP (Composio). Always search tools first for current schemas.

adrapid-automation

Automate Adrapid tasks via Rube MCP (Composio). Always search tools first for current schemas.

adyntel-automation

Automate Adyntel tasks via Rube MCP (Composio). Always search tools first for current schemas.

aeroleads-automation

Automate Aeroleads tasks via Rube MCP (Composio). Always search tools first for current schemas.

aero-workflow-automation

Automate Aero Workflow tasks via Rube MCP (Composio). Always search tools first for current schemas.

affinda-automation

Automate Affinda tasks via Rube MCP (Composio). Always search tools first for current schemas.

affinity-automation

Automate Affinity tasks via Rube MCP (Composio). Always search tools first for current schemas.

agencyzoom-automation

Automate Agencyzoom tasks via Rube MCP (Composio). Always search tools first for current schemas.

agent-mail-automation

Automate Agent Mail tasks via Rube MCP (Composio). Always search tools first for current schemas.

agentql-automation

Automate Agentql tasks via Rube MCP (Composio). Always search tools first for current schemas.

agenty-automation

Automate Agenty tasks via Rube MCP (Composio). Always search tools first for current schemas.

관련 스킬