Agent skill · data analytics · jeremylongshore

langchain-observability

Wire LangSmith tracing and custom metric callbacks into a LangChain\

Why this skill is useful

Provides specific setup instructions and custom metric callback patterns for LangChain and LangGraph that the AI wouldn't reliably generate on its own.

What it needs

Requires langchain-core, langgraph, langsmith, python installed locally. Requires langsmith account access. About 7k tokens when loaded. Last updated 2026-08-07. 2,604 stars on the source repository.

What this skill does

LangChain Observability (Python) Overview Engineer sets LANGCHAINTRACINGV2=true and LANGCHAINAPIKEY=... from the 0.2 docs, restarts the service, and sees zero traces in LangSmith — no errors, no warnings. That is P26: in LangChain 1.0 the canonical env vars are LANGSMITHTRACING and LANGSMITHAPIKEY. The LANGCHAIN names are soft-deprecated and fail silently on any chain that goes through 1.0 middleware or createreactagent. One-line fix: Next failure mode: a custom BaseCallbackHandler attached via chain.withconfig(callbacks=[meter]) fires on the parent but is silent on LangGraph subgraphs and createreactagent tool calls — token counts under-report by 30-70% vs the provider dashboard. That is P28: LangGraph creates a child runtime per subgraph, and bound callbacks do not propagate. Pass callbacks at invocation time instead: This skill walks through canonical LangSmith setup, a metric-callback template with tenant dimensions, invocation-time propagation, RunnableConfig trace tagging, and a decision tree for LangSmith-only vs OTEL-native (defer to langchain-otel-observability / L33 for OTEL-heavy). Pin: langchain-core 1.0.x, langgraph 1.0.x, langsmith current. LangSmith tracing adds <5ms per-span overhead; metric callbacks add <1ms per fire. Pain-catalog anchors: P26, P28, P04 (cache-token aggregation), P25 (retry double-counting). Prerequisites Python 3.10+ langchain-core >= 1.0, < 2.0, langgraph >= 1.0, < 2.0 langsmith (bundled with langchain; upgrade to current for 1.0 env-var support) A LangSmith API key (lsv2...) — free tier at https://smith.langchain.com Optional metric sinks: prometheusclient, statsd, or datadog Python packages Instructions Step 1 — Enable LangSmith with the canonical 1.0 env vars LANGSMITHTRACING=true is the switch. LANGSMITHAPIKEY authenticates. LANGSMITHPROJECT groups traces by environment — use one project per service-env pair (myapp-prod, myapp-staging), not one per service. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills jeremylongshore/langchain-observability

View the source on GitHub

Browse the @skills marketplace