These are contribution guidelines for our open source projects, but they also apply to the LangSmith documentation.
Contribute
Quick edits
For quick changes like fixing typos or changing a link, you can edit directly on GitHub without setting up a local development environment:Prerequisites:
- A GitHub account
- Basic familiarity of the fork-and-pull workflow for contributing
- At the bottom of the page you want to edit, click the link Edit the source of this page on GitHub.
- GitHub will prompt you to fork the repository to your account. Make sure to fork into your .
- Make the changes directly in GitHub’s web editor.
- Click Commit changes… and give your commit a descriptive title like
fix(docs): summary of change. If applicable, add an extended description. - GitHub will redirect you to create a pull request. Give it a title (often the same as the commit) and follow the PR template checklist.
Docs PRs are typically reviewed within a few days. Keep an eye on your PR to address any feedback from maintainers.Do not bump the PR unless you have new information to provide – maintainers will address it as their availability permits.
Larger edits and additions
For larger changes, additions, or ongoing contributions, it’s necessary to set up a local development environment on your machine. Our documentation build pipeline offers local preview, important for ensuring your changes appear as intended before submitting.Set up local environment
Before you can work on this project, ensure you have the following installed: Required:python >= 3.13, < 4.0uv- Python package manager (used for dependency management)- Node.js and
npm- For Mintlify CLI and reference documentation builds - Make - For running build commands
- Git - For version control
-
markdownlint-cli- For linting markdown files -
pnpm- Required only if you’re working on reference documentation - Mintlify MDX VSCode extension
-
Clone the
langchain-ai/docsrepo. Follow the steps outlined inIDE_SETUP.md. -
Install dependencies:
This command will:
- Install Python dependencies using
uv sync --all-groups - Install Mintlify CLI globally via npm
- Install Python dependencies using
-
Verify your setup:
This should build the documentation without errors.
docs command:
docs dev- Start development mode with file watching and hot reloaddocs build- Build documentation
Edit documentation
Only edit files in
src/ – The build/ directory is automatically generated.-
Ensure your environment is set up and that you have followed the steps in
IDE_SETUP.mdto configure your IDE/editor to automatically apply the correct settings. -
Edit files in
src/- Make changes to markdown files and the build system will automatically detect changes and rebuild affected files.
- If OSS content varies between Python and JavaScript/TypeScript, add content for both in the same file. Otherwise, content will be identical for both languages.
- Use Mintlify syntax for formatting.
-
Start development mode to preview changes locally:
This starts a development server with hot reload at
http://localhost:3000. -
Iterate
- Continue editing and see changes reflected immediately.
- The development server rebuilds only changed files for faster feedback.
- Run the quality checks to ensure your changes are valid.
- Get approval from the relevant reviewers. LangChain team members can generate a sharable preview build
- Publish to production (team members only).
Create a sharable preview build
Only LangChain team members can create sharable preview builds.
Instructions
Instructions
Previews are useful for sharing work-in-progress changes with others.When you create or update a PR, a preview branch/ID is automatically generated for you. A comment will be left on the PR with the ID, which you can then use to generate a preview. (You can also run this workflow manually if needed.)
- Copy the preview branch’s ID from the comment.
- In the Mintlify dashboard, click Create preview deployment.
- Enter the preview branch’s ID.
- Click Create deployment. A Manual update will display in the Previews table.
- Select the preview and click Visit to view the preview build.
Run quality checks
Before submitting changes, ensure your code passes formatting and linting checks:README.
Publish to prod
Only internal team members can publish to production.
Instructions
Instructions
Once your branch has been merged into
main, you need to push the changes to prod for them to render on the live docs site. Use the Publish documentation GH action:- Go to Publish documentation.
- Click the Run workflow button.
- Select the main branch to deploy.
- Click Run workflow.
Documentation types
All documentation falls under one of four categories:How-to guides
Task-oriented instructions for users who know what they want to accomplish.
Conceptual guides
Explanations that provide deeper understanding and insights.
Reference
Technical descriptions of APIs and implementation details.
Tutorials
Lessons that guide users through practical activities to build understanding.
Where applicable, all documentation must have both Python and JavaScript/TypeScript content. For more details, see the co-locate Python and JavaScript/TypeScript content section.
How-to guides
How-to guides are task-oriented instructions for users who know what they want to accomplish. Examples of how-to guides are on the LangChain and LangGraph tabs.Characteristics
Characteristics
- Task-focused: Focus on a specific task or problem
- Step-by-step: Break down the task into smaller steps
- Hands-on: Provide concrete examples and code snippets
Tips
Tips
- Focus on the how rather than the why
- Use concrete examples and code snippets
- Break down the task into smaller steps
- Link to related conceptual guides and references
Conceptual guides
Conceptual guide cover core concepts abstractly, providing deep understanding.Characteristics
Characteristics
- Understanding-focused: Explain why things work as they do
- Broad perspective: Higher and wider view than other types
- Design-oriented: Explain decisions and trade-offs
- Context-rich: Use analogies and comparisons
Tips
Tips
- Focus on the “why” rather than the “how”
- Provides supplementary information not necessarily required for feature usage
- Can use analogies and reference alternatives
- Avoid blending in too much reference content
- Link to related tutorials and how-to guides
Examples
Examples
Reference
Reference documentation contains detailed, low-level information describing exactly what functionality exists and how to use it. A good reference should:- Describe what exists (all parameters, options, return values)
- Be comprehensive and structured for easy lookup
- Serve as the authoritative source for technical details
Contributing to references
Contributing to references
See the contributing guide for Python reference docs.
LangChain reference best practices
LangChain reference best practices
- Be consistent; follow existing patterns for provider-specific documentation
- Include both basic usage (code snippets) and common edge cases/failure modes
- Note when features require specific versions
When to create new reference documentation
When to create new reference documentation
- New integrations or providers need dedicated reference pages
- Complex configuration options require detailed explanation
- API changes introduce new parameters or behavior
- Community frequently asks questions about specific functionality
Tutorials
Tutorials are longer form step-by-step guides that builds upon itself and takes users through a specific practical activity to build understanding. Tutorials are typically found on the Learn tab.We generally do not merge new tutorials from outside contributors without an acute need. If you feel that a certain topic is missing from docs or is not sufficiently covered, please open a new issue.
Characteristics
Characteristics
- Practical: Focus on practical activities to build understanding.
- Step-by-step: Break down the activity into smaller steps.
- Hands-on: Provide sequential, working code snippets.
- Supplementary: Provide additional context and information not necessarily required for feature usage.
Tips
Tips
- Code snippets should be sequential and working if the user follows the steps in order.
- Provide some context for the activity, but link to related conceptual guides and references for more detailed information.
Examples
Examples
Writing standards
Reference documentation has different standards - see the reference docs contributing guide for details.
Mintlify components
Use Mintlify components to enhance readability:- Callouts
- Structure
- Code
<Note>for helpful supplementary information<Warning>for important cautions and breaking changes<Tip>for best practices and advice<Info>for neutral contextual information<Check>for success confirmations
Page structure
Every documentation page must begin with YAML frontmatter:Co-locate Python and JavaScript/TypeScript content
All documentation must be written in both Python and JavaScript/TypeScript when possible. To do so, we use a custom in-line syntax to differentiate between sections that should appear in one or both languages:/oss/python/concepts/foo.mdx and /oss/javascript/concepts/foo.mdx. Each outputted page will need to be added to the /src/docs.json file to be included in the navigation.
We don’t want a lack of parity to block contributions. If a feature is only available in one language, it’s okay to have documentation only in that language until the other language catches up. In such cases, please include a note indicating that the feature is not yet available in the other language.If you need help translating content between Python and JavaScript/TypeScript, please ask in the community slack or tag a maintainer in your PR.
Quality standards
General guidelines
Avoid duplication
Avoid duplication
Multiple pages covering the same material are difficult to maintain and cause confusion. There should be only one canonical page for each concept or feature. Link to other guides instead of re-explaining.
Link frequently
Link frequently
Documentation sections don’t exist in a vacuum. Link to other sections frequently to allow users to learn about unfamiliar topics. This includes linking to API references and conceptual sections.
Be concise
Be concise
Take a less-is-more approach. If another section with a good explanation exists, link to it rather than re-explain, unless your content presents a new angle.
Accessibility requirements
Ensure documentation is accessible to all users:- Structure content for easy scanning with headers and lists
- Use specific, actionable link text instead of “click here”
- Include descriptive alt text for all images and diagrams
Cross-referencing
Use consistent cross-references to connect docs with API reference documentation. From docs to API reference: Use the@[] syntax to link to API reference pages:
@[ChatAnthropic] becomes a link to the Python or JS API reference page depending on which version of the docs is being built, but only if an entry exists in the link_map.py file! See below for details.
How autolinks work
How autolinks work
The
Adding new links:If a link isn’t found in the map, it will be left unchanged in the output. To add a new autolink:
@[] syntax is processed by handle_auto_links.py. It looks up link keys in link_map.py, which contains dictionary mappings for both Python and JavaScript scopes.Supported formats:| Syntax | Result |
|---|---|
@[ChatAnthropic] | Link with “ChatAnthropic” as the displayed text |
@[`ChatAnthropic`] | Link with `ChatAnthropic` (code formatted) as text |
@[text][ChatAnthropic] | Link with “text” as text and ChatAnthropic as the key in the link map |
\@[ChatAnthropic] | Escaped: renders as literal @[ChatAnthropic] (no link – what’s being used on this page!) |
- Open
pipeline/preprocessors/link_map.py - Add an entry to the appropriate scope (
pythonorjs) inLINK_MAPS - The key is the link name used in
@[key]or@[text][key], the value is the path relative to the reference host
README for more information on linking from API reference stubs to Python OSS docs. Specifically see the mkdocstrings cross-reference linking syntax.