docs(langchain): add tutorial reference + Python LangChain module reference#178
Conversation
…erence
Three changes for the LangChain integration docs:
1. docs/integrate/add-to-your-agent/langchain.mdx:
- <Card> link to the new langchain-paid-agent-py tutorial at the top
- "Discovery-first flow with create_paid_react_agent (Python)"
subsection that shows the x402 discovery → token-acquisition → retry
pattern using the new SDK helpers
- "Reading the settlement receipt" subsection using last_settlement()
- <Note> callout on fixed-vs-range plan credit semantics in the
Dynamic Credits section (per nvm-monorepo#1568)
2. NEW docs/api-reference/python/langchain-module.mdx: full Python
module reference covering requires_payment, PaymentRequiredError,
last_settlement, create_paid_react_agent + end-to-end example.
3. docs.json: wires the new module page into the Python API reference
sidebar after x402-module.
Surfaced during Sprint 0 of the LangChain integration epic
(nevermined-io/nvm-monorepo#1703). The new helpers
(last_settlement, create_paid_react_agent) are on payments-py main
via #183 but await a release — merging this PR should be coordinated
with the payments-py 1.6.1+ release.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
aaitor
left a comment
There was a problem hiding this comment.
Tight docs PR that fully matches the payments-py #183 surface I just reviewed. The new langchain-module.mdx reference page documents all four exports (requires_payment, PaymentRequiredError, last_settlement, create_paid_react_agent) with signatures, the credits-semantics note pointing at nvm-monorepo#1568, and the same multi-tenant warning on last_settlement() that's in the SDK docstring. The integration-guide additions (Discovery-first flow + Reading the settlement receipt + Dynamic Credits clarification) thread cleanly with the new reference page. Cross-references all pass Mintlify link-rot. Approving with two LOW body observations and a merge-gate reminder.
Verification I ran
gh pr diff 178(427 lines, all signal — no lockfile-style noise).- Cross-checked every code example in
langchain-module.mdxagainst the actual SDK shapes I verified in payments-py #183:X402TokenOptions(scheme=..., delegation_config=DelegationConfig(...))wrapping — matchesget_x402_access_token(plan_id, agent_id=None, token_options=None)signature.from payments_py.x402.langchain import ...exports list — matches the__all__I saw in the SDK PR.last_settlement()multi-tenant<Warning>wording — verbatim mirror of the SDK docstring.creditssemantics note — accurate per the nvm-monorepo#1568 fixed-vs-range behaviour (matches the SDK's updatedrequires_paymentdocstring I read yesterday).
- Verified
docs.jsonslot forlangchain-modulelands afterx402-modulein the Python API reference sidebar (line 272 of the diff). - Verified the new module page's section anchors (
#requires-payment,#paymentrequirederror,#last-settlement,#create-paid-react-agent,#credits-semantics) match the cross-link target IDs fromlangchain.mdx. - Spot-checked the apparent
docs/api-reference/convention concern (the docs CLAUDE.md at L384 says "All the documentation included in the 'docs/api-reference' folder is sourced from different repositories. Don't modify it directly"): no sync workflow exists in.github/workflows/, noscripts/directory, and the existing module pages (x402-module.mdx,installation.mdx, …) have no auto-gen markers — they're hand-authored. The rule appears aspirational rather than enforced today. See the body note for the suggested follow-up. - CI:
Mintlify Deployment✓,link-rot✓,vale-spellcheckskipping (correctly). - Parallel agent panel: skipped — small docs PR, cross-referenced against the payments-py SDK PR I reviewed yesterday, no auth / DB / contract surface. The integration is fully covered by the manual verification above.
Merge-gate reminder
Author's test plan correctly flags "Hold merge until payments-py 1.6.1+ ships" as the open prerequisite. The helpers documented here (last_settlement, create_paid_react_agent) are on payments-py main (PR #183 merged) but await a release. The <Card> link at the top of langchain.mdx points at nevermined-io/tutorials/tree/main/langchain-paid-agent-py — also worth confirming that tutorial repo is ready (or close enough) on merge day, since a broken link from a freshly-deployed docs page would be visible to readers immediately.
Out-of-scope observations (not blocking)
docs/api-reference/convention drift: The docs CLAUDE.md rule ("sourced from different repositories — don't modify directly") doesn't match the current state of the repo. The pre-existing Python module pages have no auto-gen markers; no sync workflow exists. Either the rule needs to be relaxed ("sourced where applicable; new module pages can be hand-authored") or a real sync mechanism needs to be set up. Worth a small follow-up to clarify the CLAUDE.md text so future contributors don't second-guess legitimate additions like this one.skills/nevermined-payments/references/langchain-integration.mdis missing: The author's PR description acknowledges this as a pre-existing gap (other frameworks like a2a, express, fastapi, mcp, strands all have*-integration.mdfiles inskills/nevermined-payments/references/). The docs CLAUDE.md L23 explicitly asks contributors to keep these in sync with framework integration changes. Worth a small follow-up PR that mirrors the new module-reference content into alangchain-integration.mdskill reference file.
Two changes responding to aaitor's review of #178: 1. Remove docs/api-reference/python/langchain-module.mdx. The Python API reference under docs/api-reference/python/ is auto-generated on every payments-py release via the `publish-mintlify-docs.yml` workflow — the workflow does `rm -f "$TARGET_DIR"/*.mdx` before copying converted output. A hand-authored mdx here would be silently wiped on the next release. The langchain-module.mdx will instead come from nevermined-io/payments-py#187 (adds the source MD + converter FILE_MAPPING entry) once that merges and a release ships. 2. Add skills/nevermined-payments/references/langchain-integration.md. The existing skill references (a2a, express, fastapi, mcp, strands, client) all have framework-integration files; langchain was the pre-existing gap noted in this PR's description. Mirrors the patterns from strands-integration.md — quick start, payment-error flow, LangGraph helper (create_paid_react_agent), reading the receipt (last_settlement), decorator configuration variants, credits semantics, and the HTTP-middleware alternative. The docs.json sidebar slot for langchain-module stays. It links to a file that doesn't exist in the docs repo yet, but will once the SDK release pipeline lands it (per the merge sequence in the PR body). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Thanks @aaitor — your two out-of-scope observations turned into real fixes: On the convention-drift note (N1): double-checked and the rule On the skill-reference note (N2): added PR body updated with the new merge sequence. Holding until payments-py#187 lands AND a release ships. |
…lify pipeline (#187) Adds the missing 12th documentation file so the `publish-mintlify-docs.yml` workflow produces a `docs/api-reference/python/langchain-module.mdx` in the docs site on the next `v*.*.*` release tag — same flow as the existing 11 Python module pages. Changes: - `docs/api/12-langchain-integration.md` (NEW): source MD covering `requires_payment`, `PaymentRequiredError`, `last_settlement`, and `create_paid_react_agent`, plus an end-to-end discovery → token → retry walk. Plain Markdown with MkDocs admonitions so the converter produces a Mintlify-compatible MDX with frontmatter + Note/Warning components. - `scripts/convert_to_mintlify.py`: adds FILE_MAPPING + LINK_MAPPING entries for the new file. Converter ran locally — 12 of 12 files converted, 0 errors. - `.github/workflows/publish-mintlify-docs.yml`: bumps both `-lt 11` count checks to `-lt 12`, updates "Updated all 11" → "Updated all 12", and adds `langchain-module.mdx` to the auto-generated PR body's file list. Motivation: while preparing the hand-authored `docs/api-reference/python/langchain-module.mdx` in nevermined-io/docs#178 we noticed the docs CLAUDE.md rule ("sourced from different repositories — don't modify directly") was correct — `publish-mintlify-docs.yml` wipes `*.mdx` from the docs python reference dir on every release before copying the converted output. Hand-authoring in docs would have been silently deleted on the next release. This PR is the structurally correct path: source lives here, the workflow converts and lands on release. Merge sequence: 1. Merge this PR (no immediate user-facing change — the source MD is not part of the converter output until the next tag). 2. Tag a payments-py release (e.g., 1.6.1 or 1.7.0). The workflow converts, opens a PR on nevermined-io/docs, auto-merges → the new `langchain-module.mdx` lands in the docs site. 3. Then nevermined-io/docs#178 can merge (it relies on this file existing in the docs site for cross-links from the integration guide). Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
Three changes for the LangChain integration docs:
docs/integrate/add-to-your-agent/langchain.mdx— surfaces the new SDK helpers and the x402 discovery-first flow:<Card>link to the newlangchain-paid-agent-pytutorial at the top.create_paid_react_agent(Python)" subsection that walks the canonical x402 dance: invoke without a token → catchPaymentRequiredError→ readaccepts[0].scheme/network/plan_id→ acquire token viaDelegationConfig→ retry.last_settlement()— explains the LangGraph copies-configurable-per-node quirk and how the SDK works around it.<Note>callout in the Dynamic Credits section on fixed-vs-range plan credit semantics (per nvm-monorepo#1568).docs.json— sidebar slot for the newdocs/api-reference/python/langchain-modulepage (will be auto-populated by the SDK release pipeline, see below).skills/nevermined-payments/references/langchain-integration.md(NEW) — closes the pre-existing skill-ref gap that aaitor flagged. Mirrors the strands / fastapi / express patterns: quick start, discovery flow, LangGraph helper, settlement read, decorator configuration, credits semantics, and the HTTP-middleware alternative.What changed since the original PR (in response to aaitor's review)
The original PR included a hand-authored
docs/api-reference/python/langchain-module.mdxand listed the skill reference as out of scope. On checking aaitor's "convention drift" note, I confirmed there IS a Python doc-publish pipeline (payments-py/.github/workflows/publish-mintlify-docs.yml) that doesrm -f "$TARGET_DIR"/*.mdxbefore copying converted output on every release tag — so a hand-authored mdx indocs/api-reference/python/would be silently wiped. The docs CLAUDE.md rule ("sourced from different repositories — don't modify directly") is correctly stated.So this PR:
langchain-module.mdx— it now lives as a Markdown source in nevermined-io/payments-py#187 (which addsdocs/api/12-langchain-integration.md+ a FILE_MAPPING entry inscripts/convert_to_mintlify.py+ bumps the workflow's expected-file count from 11 to 12). The MDX will be generated by the release pipeline and land here automatically.Merge sequence (release-train coordination)
v1.6.1orv1.7.0). The workflow runs, opens an auto-PR on this repo with the new convertedlangchain-module.mdx, auto-merges it.langchain-module.mdx) and merges. The sidebar entry indocs.jsonlights up; cross-links fromlangchain.mdxand the skill reference resolve.Test plan
mintlify broken-links→success no broken links found.docs.jsonvalidates as JSON.Motivation
Sprint 0 of the LangChain integration epic (
nevermined-io/nvm-monorepo#1703, sub-issue#1704). The new SDK helpers (last_settlement,create_paid_react_agent) are on payments-pymainvia#183(merged) but await a release.🤖 Generated with Claude Code