Skip to content

docs(langchain): document LangSmith observability bridge (Sprint 1)#185

Merged
r-marques merged 1 commit into
mainfrom
docs/langsmith-observability-sprint-1
May 27, 2026
Merged

docs(langchain): document LangSmith observability bridge (Sprint 1)#185
r-marques merged 1 commit into
mainfrom
docs/langsmith-observability-sprint-1

Conversation

@r-marques
Copy link
Copy Markdown
Member

Summary

Adds Sprint 1 LangSmith observability coverage to two hand-maintained docs surfaces. Pairs with nevermined-io/payments-py#198 (SDK side, still draft) and implements the docs deliverable for nvm-monorepo#1705.

Files changed

File Change
docs/integrate/add-to-your-agent/langchain.mdx New ### Trace payments in LangSmith (Python) section nested under "Approach 1: Tool Decorator / Wrapper", between "Reading the settlement receipt" and "Dynamic Credits". ~51 lines.
skills/nevermined-payments/references/langchain-integration.md New ## Observability with LangSmith subsection between "Reading the settlement receipt" and "Decorator Configuration". Distilled mirror of the integration-guide section. ~18 lines.

What each section covers

  • Install the new payments-py[langsmith] optional extra
  • Enable via LANGSMITH_TRACING=true + LANGSMITH_API_KEY env vars
  • Regional LANGSMITH_ENDPOINT override for non-US accounts (GCP EU / APAC / AWS US)
  • The trace tree shape — nvm:verify and nvm:settlement as flat sibling spans under the tool
  • The nvm.* attribute set on each span (nvm.plan_ids, nvm.scheme, nvm.payer, nvm.credits_redeemed, nvm.tx_hash, etc.)
  • The "failed discovery probe" path producing a nvm:verify span with static metadata even when no payment_token is set — so probes are filterable, not opaque LangChain crashes
  • The active redaction of payment_token from the parent tool span's metadata, keeping the full x402 access token out of nvm:* spans (LangChain auto-captures from configurable — we strip before opening any child span)
  • LANGSMITH_HIDE_INPUTS=true as the blanket workaround for non-configurable token channels

What's intentionally NOT edited

Status

This is a draft because the underlying SDK changes are still in draft on payments-py#198. Once that PR is reviewed, merged, and a v1.8.0 tag goes out, mark this PR ready for review — the documented features will then exist on PyPI.

Test plan

  • Section structure preserved — no existing content moved or removed
  • All internal links use the documented path conventions (/docs/api-reference/python/langchain-module#observability-with-langsmith resolves once the SDK reference auto-publishes on next tag)
  • Local Mintlify preview (mintlify dev) renders both sections cleanly — flag at review time if any callout / code-fence formatting is off
  • mintlify broken-links passes (the link to the module-reference anchor will resolve only after payments-py releases — flag if blocking)

🤖 Generated with Claude Code

Adds a "Trace payments in LangSmith" section to the integration guide
and a matching "Observability with LangSmith" subsection to the
agent-facing skill reference. Both cover:

- Installing the new payments-py[langsmith] extra
- Enabling tracing via LANGSMITH_TRACING + LANGSMITH_API_KEY env vars
- Regional LANGSMITH_ENDPOINT override for non-US accounts
- The trace tree shape (nvm:verify + nvm:settlement child spans under
  the tool) and the nvm.* attribute set on each
- The "failed discovery probe" path producing an nvm:verify span with
  static metadata (so probes are filterable, not opaque crashes)
- Active payment_token redaction from the parent tool span's metadata
  to keep the full x402 access token out of nvm:* spans
- LANGSMITH_HIDE_INPUTS=true as the blanket workaround for non-
  configurable channels

The Mintlify-served module reference page
(docs/api-reference/python/langchain-module.mdx) is intentionally NOT
edited — it auto-updates from payments-py/docs/api/12-langchain-integration.md
on the next v*.*.* tag via publish-mintlify-docs.yml.

Implements nevermined-io/nvm-monorepo#1705 (Sprint 1 docs deliverable).
Pairs with nevermined-io/payments-py#198 (SDK side).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@r-marques r-marques marked this pull request as ready for review May 26, 2026 15:46
@r-marques r-marques requested a review from a team as a code owner May 26, 2026 15:46
@aaitor aaitor requested a review from Copilot May 26, 2026 15:47
@mintlify
Copy link
Copy Markdown

mintlify Bot commented May 26, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
Nevermined 🟢 Ready View Preview May 26, 2026, 3:49 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Sprint 1 documentation for LangSmith observability/tracing in the LangChain + Nevermined payments integration, covering how @requires_payment emits nvm:verify / nvm:settlement spans with nvm.* metadata and how token redaction works.

Changes:

  • Added a new “Trace payments in LangSmith (Python)” subsection to the LangChain integration guide with install, env config, span tree, and redaction guidance.
  • Added a mirrored “Observability with LangSmith” subsection to the Nevermined Payments skill reference for LangChain.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
docs/integrate/add-to-your-agent/langchain.mdx Adds end-user docs for enabling LangSmith tracing and interpreting Nevermined payment spans in LangChain/LangGraph.
skills/nevermined-payments/references/langchain-integration.md Adds a condensed reference version of the LangSmith observability guidance for the skill documentation surface.


If a span failure ever occurs during metadata building or attachment, observability is silently dropped — the payment flow itself is never interrupted. Settlement receipts persist via `last_settlement()` regardless of whether the span emit succeeded.

For the full module reference (function signatures, manual usage from non-LangChain code paths), see the [Python LangChain module reference](/docs/api-reference/python/langchain-module#observability-with-langsmith).
@r-marques
Copy link
Copy Markdown
Member Author

Re: Copilot's finding on the #observability-with-langsmith anchor — acknowledged and intentional.

The anchor is correct for the post-release state but doesn't exist in langchain-module.mdx on main yet. The release sequence is:

  1. payments-py#198 merges → v1.8.0 tag cut
  2. publish-mintlify-docs.yml auto-fires → converts payments-py/docs/api/12-langchain-integration.md (which already contains the ## Observability with LangSmith heading) to MDX → auto-opens and auto-merges a PR in this repo adding the section to docs/api-reference/python/langchain-module.mdx
  3. The anchor #observability-with-langsmith now resolves
  4. This PR is marked ready for review

So this PR is intentionally draft until step 3 completes. If mintlify broken-links runs in CI on draft PRs and blocks here, I'll drop the anchor; otherwise leaving it for the better post-release deep-link UX.

@r-marques r-marques merged commit e383131 into main May 27, 2026
4 checks passed
r-marques added a commit to nevermined-io/tutorials that referenced this pull request May 27, 2026
…dge (#53)

Wires the tutorial to the new LangSmith observability bridge shipped
in payments-py 1.8.0 (Sprint 1 of the LangChain partnership epic).

Zero code changes in src/ — the bridge is fully zero-config opt-in via
env vars on top of the existing Sprint 0 agent + buyer.

Changes:
- pyproject.toml: payments-py dep bumped to ^1.8.0 with both extras
  ([langchain, langsmith]); tutorial version 1.0.0 -> 1.1.0.
- .env.example: new "Observability (optional)" block with LANGSMITH_*
  vars (TRACING, API_KEY, PROJECT) and the regional LANGSMITH_ENDPOINT
  fallback table for GCP EU / APAC / AWS US accounts.
- README.md: new "Observability with LangSmith (optional)" section
  (~48 lines) covering install / enable / re-run / what to expect in
  the trace tree, plus the active payment_token redaction privacy note.

Pairs with:
- nevermined-io/payments-py#198 (SDK side, draft)
- nevermined-io/docs#185 (Mintlify docs, draft)

Implements nevermined-io/nvm-monorepo#1705 (Sprint 1 tutorial deliverable).

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants