---
name: langsmith-tracing-f1b464d41857
description: LangSmith tracing and debugging setup for LLM applications. Configure observability, capture traces, and enable debugging for LangChain/LangGraph agents.
allowed-tools: Read, Grep, Write, Edit, Bash, Glob, WebFetch
graph:
  domains: [domain:software-engineering]
  specializations: [specialization:ai-agents-conversational]
  skillAreas: [skill-area:agent-debugging-logging, skill-area:agent-simulation-testing]
  roles: [role:ml-engineer, role:backend-engineer]
  workflows: [workflow:ml-model-lifecycle, workflow:feature-development]

---

# langsmith-tracing

Configure LangSmith observability and tracing for LLM applications built with LangChain and LangGraph frameworks.

## Overview

LangSmith is the managed observability suite by LangChain that provides:
- Dashboards and alerting for LLM applications
- Human-in-the-loop evaluation capabilities
- Deep LangChain/LangGraph integration
- Run Tree model for nested traces
- MCP connectivity to Claude, VSCode

## Capabilities

### Core Tracing Setup
- Initialize LangSmith client and API configuration
- Configure project/workspace settings
- Set up trace collection and sampling
- Enable debug logging for agent execution

### Integration Patterns
- LangChain chain tracing with automatic instrumentation
- LangGraph workflow state tracking
- Custom span creation for non-LangChain code
- Parent-child trace relationships

### Debugging Features
- Fetch execution traces for analysis
- Query run history and metadata
- Export traces for offline analysis
- Compare runs across different versions

## Usage

### Environment Setup

```bash
# Set required environment variables
export LANGCHAIN_TRACING_V2=true
export LANGCHAIN_API_KEY=<your-api-key>
export LANGCHAIN_PROJECT=<project-name>
```

### Python Integration

```python
from langsmith import Client, traceable
from langchain.callbacks.tracers import LangChainTracer

# Initialize client
client = Client()

# Use @traceable decorator for custom functions
@traceable(name="custom_operation")
def my_function(input_data):
    # Your logic here
    return result

# Initialize tracer for LangChain
tracer = LangChainTracer(project_name="my-project")

# Use with LangChain chains
chain.invoke(input, config={"callbacks": [tracer]})
```

### Trace Retrieval

```python
# Fetch traces from LangSmith
runs = client.list_runs(
    project_name="my-project",
    start_time=datetime.now() - timedelta(hours=24),
    execution_order=1,  # Root runs only
    error=False,  # Successful runs only
)

for run in runs:
    print(f"Run ID: {run.id}")
    print(f"Latency: {run.latency_p99}")
    print(f"Tokens: {run.total_tokens}")
```

## Task Definition

When used in a babysitter process, this skill produces:

```javascript
const langsmithTracingTask = defineTask({
  name: 'langsmith-tracing-setup',
  description: 'Configure LangSmith tracing for the application',

  inputs: {
    projectName: { type: 'string', required: true },
    apiKeyEnvVar: { type: 'string', default: 'LANGCHAIN_API_KEY' },
    samplingRate: { type: 'number', default: 1.0 },
    enableDebug: { type: 'boolean', default: false }
  },

  outputs: {
    configured: { type: 'boolean' },
    projectUrl: { type: 'string' },
    artifacts: { type: 'array' }
  },

  async run(inputs, taskCtx) {
    return {
      kind: 'skill',
      title: `Configure LangSmith tracing for ${inputs.projectName}`,
      skill: {
        name: 'langsmith-tracing',
        context: {
          projectName: inputs.projectName,
          apiKeyEnvVar: inputs.apiKeyEnvVar,
          samplingRate: inputs.samplingRate,
          enableDebug: inputs.enableDebug,
          instructions: [
            'Verify LangSmith API credentials are available',
            'Create or validate project configuration',
            'Set up tracing instrumentation in codebase',
            'Configure sampling rate and debug settings',
            'Verify traces are being captured correctly'
          ]
        }
      },
      io: {
        inputJsonPath: `tasks/${taskCtx.effectId}/input.json`,
        outputJsonPath: `tasks/${taskCtx.effectId}/result.json`
      }
    };
  }
});
```

## Applicable Processes

- llm-observability-monitoring
- agent-evaluation-framework
- react-agent-implementation
- conversation-quality-testing
- regression-testing-agent

## External Dependencies

- LangSmith account and API key
- LangChain Python library
- langsmith Python package

## References

- [LangSmith Documentation](https://docs.langchain.com/langsmith/observability)
- [LangSmith Fetch Skill](https://github.com/ComposioHQ/awesome-claude-skills/tree/master/langsmith-fetch)
- [Langfuse Integration](https://langfuse.com)
- [Comet Opik MCP](https://github.com/comet-ml/opik-mcp)

## Related Skills

- SK-OBS-002 langfuse-integration
- SK-OBS-003 phoenix-arize-setup
- SK-OBS-004 opentelemetry-llm

## Related Agents

- AG-OPS-004 observability-engineer
- AG-SAF-004 agent-evaluator


---
Source attribution: a5c-ai
Original project: https://github.com/a5c-ai/babysitter
License: MIT
License information: https://opensource.org/license/mit
Original upstream instructions; downloaded from Mega AI Hub.

## Upstream license notice

MIT License

Copyright (c) 2026 Gabriel Moreira

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



# Mega AI Hub resource metadata

Creator / publisher: a5c-ai
Original project: https://github.com/a5c-ai/babysitter
Attribution basis: Upstream repository explicitly recorded in package mirror path

Fields of work: Data & Analytics, Development & Engineering, Product Management
Roles: Data Scientist, Growth Product Manager, ML / AI Engineer, Product Manager, Technical Product Manager
Specialties: API
Tools: GitHub, Langsmith, Slack
Country applicability: Country not specified
Classification basis: Source catalog labels
Instruction SHA-256: f37e44362803dd3ffcc3fa32bb262c19863869f257eb366c013b12678ffebbcd
