# langsmith-fetch

Saves LangSmith traces to local files so you can inspect an agent's tool calls and conversation history while debugging.

Skill by LangChain. Category: Testing.

## Install

Project (for this project only):

```sh
npx skills add langchain-ai/lca-skills --skill langsmith-fetch
```

Works with: Claude Code, Codex CLI, Cursor, Antigravity, Copilot CLI, opencode.

Global (for every project on this machine):

```sh
npx skills add langchain-ai/lca-skills --skill langsmith-fetch -g
```

Works with: Claude Code, Codex CLI, Cursor, Antigravity, Copilot CLI, opencode.

## Tags

- Runs on your computer: It runs as a program on your machine, with your access.

## Security audits

- Gen Agent Trust Hub: Pass
- Socket: Pass
- Snyk: Pass
- Runlayer: Fail
- ZeroLeaks: Pass

Installs: 627. Installs counted by skills.sh. [Open on skills.sh](https://www.skills.sh/langchain-ai/lca-skills/langsmith-fetch)

## Source

[Open the source](https://github.com/langchain-ai/lca-skills/tree/HEAD/skills/langsmith-fetch). Checked 2026-10-10. This summary may contain AI-generated text, so it can be wrong. Check the source before you rely on it.

## SKILL.md

````markdown
---
name: langsmith-fetch
description: Fetches LangSmith traces for debugging agent behavior. Use when troubleshooting agent issues, reviewing conversation history, or investigating tool calls.
---

# Fetching LangSmith Traces

Requires `langsmith-fetch` in project dependencies and `LANGSMITH_API_KEY` in a `.env` file.

## Setup

First, find the `.env` file containing `LANGSMITH_API_KEY`:
```bash
find . -name ".env" -type f 2>/dev/null | head -5
```

## Commands

Use `--env-file <path-to-.env>` with all commands:

```bash
# Fetch recent traces (uses LANGSMITH_PROJECT from .env, or specify --project-uuid)
uv run --env-file <path> langsmith-fetch traces ./traces --limit 10
uv run --env-file <path> langsmith-fetch traces ./traces --project-uuid <uuid> --limit 10

# Fetch single trace by ID
uv run --env-file <path> langsmith-fetch trace <trace-id>

# Include metadata (timing, tokens, costs)
uv run --env-file <path> langsmith-fetch trace <trace-id> --include-metadata
```

## Output Formats

- `--format pretty` - Human-readable (default)
- `--format json` - Pretty-printed JSON
- `--format raw` - Compact JSON for piping

## Troubleshooting Workflow

1. Find `.env`: `find . -name ".env" -type f 2>/dev/null`
2. Fetch recent traces: `uv run --env-file <path> langsmith-fetch traces ./debug --limit 10`
3. Find relevant trace in saved JSON files
4. Check: What tools were called? What did they return? Was it correct/expected?
````

- Previous: [sprites](https://syn4pse.dev/terminal/sprites-plugin.md)
- Next: [datocms-cma](https://syn4pse.dev/terminal/datocms-cma.md)
- [Terminal](https://syn4pse.dev/terminal.md)
- [Suggest a change](mailto:terminal@syn4pse.dev?subject=Terminal%20suggestion)
