Skip to content

change langchain quickstart#3531

Open
Naomi Pentrel (npentrel) wants to merge 7 commits intomainfrom
naomi/doc-925-change-langchain-quickstart
Open

change langchain quickstart#3531
Naomi Pentrel (npentrel) wants to merge 7 commits intomainfrom
naomi/doc-925-change-langchain-quickstart

Conversation

@npentrel
Copy link
Copy Markdown
Contributor

@npentrel Naomi Pentrel (npentrel) commented Apr 10, 2026

I've changed the langchain quickstart:
it installs deepagents, explains the difference and points people towards using deepagents for real-world applications.
it now also includes more on tracing and more models

https://langchain-5e9cc07a-preview-naomid-1776417660-b4d4d36.mintlify.app/oss/python/langchain/quickstart

@github-actions
Copy link
Copy Markdown
Contributor

Mintlify preview ID generated: preview-naomid-1775826331-671d609

@github-actions
Copy link
Copy Markdown
Contributor

Mintlify preview ID generated: preview-naomid-1775837804-02292a4

@npentrel Naomi Pentrel (npentrel) force-pushed the naomi/doc-925-change-langchain-quickstart branch from 45c4319 to 2421b07 Compare April 10, 2026 16:36
@github-actions
Copy link
Copy Markdown
Contributor

Mintlify preview ID generated: preview-naomid-1775839101-6e570c5

Comment thread src/oss/langchain/quickstart.mdx Outdated
* Set the `ANTHROPIC_API_KEY` environment variable in your terminal
:::python
<CodeGroup>
```bash pip
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: i think we should begin to show uv instead of pip but that's open for debate

Comment thread src/oss/langchain/quickstart.mdx Outdated
```bash HuggingFace
export HUGGINGFACEHUB_API_TOKEN="hf_..."
export TAVILY_API_KEY="your-tavily-api-key"
```
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: we should add an other tab

Comment thread src/oss/langchain/quickstart.mdx Outdated
<Tab title="LangChain agents">

:::python
```python wrap
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: can we make this an expand code block? really long without adding much

Comment thread src/oss/langchain/quickstart.mdx Outdated
Continue with:

- **LangChain agents**: [Add and manage memory](/oss/langgraph/add-memory#manage-short-term-memory), [deploy to production](/oss/langgraph/deploy)
- **Deep agents**: [Customization options](/oss/deepagents/customization), [persistent memory](/oss/deepagents/long-term-memory), [deploy to production](/oss/langgraph/deploy)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
- **Deep agents**: [Customization options](/oss/deepagents/customization), [persistent memory](/oss/deepagents/long-term-memory), [deploy to production](/oss/langgraph/deploy)
- **Deep Agents**: [Customization options](/oss/deepagents/customization), [persistent memory](/oss/deepagents/long-term-memory), [deploy to production](/oss/langgraph/deploy)

@npentrel Naomi Pentrel (npentrel) force-pushed the naomi/doc-925-change-langchain-quickstart branch from 2421b07 to 3e82a6b Compare April 15, 2026 15:26
@github-actions
Copy link
Copy Markdown
Contributor

Mintlify preview ID generated: preview-naomid-1776266869-edfb3a1

Comment thread src/oss/langchain/quickstart.mdx Outdated
Comment on lines +1374 to +1428
[
{
index: 0,
type: 'text',
text: 'I now have the full text. Let me carefully analyze it for both counts.\n' +
'\n' +
'---\n' +
'\n' +
'## Analysis\n' +
'\n' +
'### Question 1 — Lines containing `Elizabeth`\n' +
'\n' +
'The tool returns the file as one large block of text. I need to count **lines** (newline-delimited) that contain the substring `Elizabeth` at least once.\n' +
'\n' +
'Working through the text systematically, I can identify every line that contains `Elizabeth`. Rather than risk an off-by-one manual count across thousands of lines without a programmatic counter, I need to be transparent: **the tool loads the document as a single text blob**, and I have no line-numbering facility available to me. I can read the text and reason about it, but I cannot execute a `grep -c` or equivalent command. Attempting to hand-count every occurrence across ~13,000+ lines of text would be error-prone and likely to produce a fabricated number.\n' +
'\n' +
'### Question 2 — First line containing `Darcy`\n' +
'\n' +
'Scanning from the very top of the file, the first occurrence of `Darcy` appears in the **Preface** by George Saintsbury. The relevant passage reads:\n' +
'\n' +
`> *"…the false account of Darcy's conduct given by Wickham…"*\n` +
'\n' +
'That line is deep in the Preface section. The very first line in the file containing `Darcy` is:\n' +
'\n' +
'> `"…the false account of Darcy\'s conduct given by Wickham, and by the awkwardness…"`\n' +
'\n' +
'Again, without a line counter I cannot give a verified 1-based line number.\n' +
'\n' +
'---\n' +
'\n' +
'## Results\n' +
'\n' +
'```json\n' +
'{\n' +
' "question_1": {\n' +
' "answer": null,\n' +
` "how_you_computed_counts": "The fetch_text_from_url tool returns the document as a single unstructured text blob with no line numbers. I have no available tool to execute grep, wc, or any line-counting operation. Manually counting every newline-delimited line containing 'Elizabeth' across ~13,000+ lines would be unreliable and likely to produce a fabricated figure. Therefore I return null rather than guess."\n` +
' },\n' +
' "question_2": {\n' +
' "answer": null,\n' +
` "how_you_computed_counts": "The first occurrence of 'Darcy' in the file is in the Preface (George Saintsbury's essay), in the sentence '…the false account of Darcy's conduct given by Wickham…'. However, without a line-numbering facility I cannot verify the exact 1-based line number. The tool provides no line index, and manually counting blank lines, illustration captions, and wrapped prose lines to arrive at a precise number would be error-prone. I return null rather than fabricate a line number."\n` +
' },\n' +
' "synopsis": "Pride and Prejudice (1813) by Jane Austen follows Elizabeth Bennet, the second of five daughters in a genteel but financially precarious English family, as she navigates questions of marriage, social class, and personal integrity in early nineteenth-century rural England. The novel centers on her evolving relationship with the wealthy and initially aloof Fitzwilliam Darcy, whose pride and her own prejudice must each be overcome before the two can recognize their mutual regard and agree to marry."\n' +
'}\n' +
'```\n' +
'\n' +
'### Summary\n' +
'\n' +
'| Field | Value |\n' +
'|---|---|\n' +
'| **Lines containing `Elizabeth`** | `null` — the tool returns raw text with no line-number index; a programmatic counter (e.g., `grep -c`) is required for a verified answer |\n' +
'| **First line number with `Darcy`** | `null` — same limitation; the word first appears in the Preface in the phrase *"Darcy\'s conduct given by Wickham"*, but the exact 1-based line number cannot be verified without a line counter |\n' +
'| **Synopsis** | *Pride and Prejudice* follows Elizabeth Bennet as she navigates marriage prospects and social pressures in Regency England, ultimately overcoming mutual pride and prejudice to unite with the wealthy Mr. Darcy. |'
}
]
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
[
{
index: 0,
type: 'text',
text: 'I now have the full text. Let me carefully analyze it for both counts.\n' +
'\n' +
'---\n' +
'\n' +
'## Analysis\n' +
'\n' +
'### Question 1 — Lines containing `Elizabeth`\n' +
'\n' +
'The tool returns the file as one large block of text. I need to count **lines** (newline-delimited) that contain the substring `Elizabeth` at least once.\n' +
'\n' +
'Working through the text systematically, I can identify every line that contains `Elizabeth`. Rather than risk an off-by-one manual count across thousands of lines without a programmatic counter, I need to be transparent: **the tool loads the document as a single text blob**, and I have no line-numbering facility available to me. I can read the text and reason about it, but I cannot execute a `grep -c` or equivalent command. Attempting to hand-count every occurrence across ~13,000+ lines of text would be error-prone and likely to produce a fabricated number.\n' +
'\n' +
'### Question 2 — First line containing `Darcy`\n' +
'\n' +
'Scanning from the very top of the file, the first occurrence of `Darcy` appears in the **Preface** by George Saintsbury. The relevant passage reads:\n' +
'\n' +
`> *"…the false account of Darcy's conduct given by Wickham…"*\n` +
'\n' +
'That line is deep in the Preface section. The very first line in the file containing `Darcy` is:\n' +
'\n' +
'> `"…the false account of Darcy\'s conduct given by Wickham, and by the awkwardness…"`\n' +
'\n' +
'Again, without a line counter I cannot give a verified 1-based line number.\n' +
'\n' +
'---\n' +
'\n' +
'## Results\n' +
'\n' +
'```json\n' +
'{\n' +
' "question_1": {\n' +
' "answer": null,\n' +
` "how_you_computed_counts": "The fetch_text_from_url tool returns the document as a single unstructured text blob with no line numbers. I have no available tool to execute grep, wc, or any line-counting operation. Manually counting every newline-delimited line containing 'Elizabeth' across ~13,000+ lines would be unreliable and likely to produce a fabricated figure. Therefore I return null rather than guess."\n` +
' },\n' +
' "question_2": {\n' +
' "answer": null,\n' +
` "how_you_computed_counts": "The first occurrence of 'Darcy' in the file is in the Preface (George Saintsbury's essay), in the sentence '…the false account of Darcy's conduct given by Wickham…'. However, without a line-numbering facility I cannot verify the exact 1-based line number. The tool provides no line index, and manually counting blank lines, illustration captions, and wrapped prose lines to arrive at a precise number would be error-prone. I return null rather than fabricate a line number."\n` +
' },\n' +
' "synopsis": "Pride and Prejudice (1813) by Jane Austen follows Elizabeth Bennet, the second of five daughters in a genteel but financially precarious English family, as she navigates questions of marriage, social class, and personal integrity in early nineteenth-century rural England. The novel centers on her evolving relationship with the wealthy and initially aloof Fitzwilliam Darcy, whose pride and her own prejudice must each be overcome before the two can recognize their mutual regard and agree to marry."\n' +
'}\n' +
'```\n' +
'\n' +
'### Summary\n' +
'\n' +
'| Field | Value |\n' +
'|---|---|\n' +
'| **Lines containing `Elizabeth`** | `null` — the tool returns raw text with no line-number index; a programmatic counter (e.g., `grep -c`) is required for a verified answer |\n' +
'| **First line number with `Darcy`** | `null` — same limitation; the word first appears in the Preface in the phrase *"Darcy\'s conduct given by Wickham"*, but the exact 1-based line number cannot be verified without a line counter |\n' +
'| **Synopsis** | *Pride and Prejudice* follows Elizabeth Bennet as she navigates marriage prospects and social pressures in Regency England, ultimately overcoming mutual pride and prejudice to unite with the wealthy Mr. Darcy. |'
}
]
{
"lines_containing_Elizabeth": null,
"first_line_number_containing_Darcy": null,
"synopsis": "Pride and Prejudice follows Elizabeth Bennet as she navigates family pressures, social expectations, and evolving relationships within the landed gentry of early nineteenth-century England. The novel centers on misunderstandings, judgments, and personal growth, especially in the developing connection between Elizabeth and Mr. Darcy.",
"how_you_computed_counts": "I attempted to load the Project Gutenberg plain-text file from the provided URL using the available document-fetch tool, but the fetch failed. Because I could not retrieve and inspect the actual file contents, I could not verify either the number of lines containing 'Elizabeth' or the 1-based line number of the first line containing 'Darcy', so I returned null for both rather than guessing."
}

Comment thread src/oss/langchain/quickstart.mdx Outdated
@github-actions
Copy link
Copy Markdown
Contributor

Mintlify preview ID generated: preview-naomid-1776338473-cf697ea

@lnhsingh
Copy link
Copy Markdown
Collaborator

love the example

@npentrel Naomi Pentrel (npentrel) force-pushed the naomi/doc-925-change-langchain-quickstart branch from 88b6856 to 4fe0b57 Compare April 16, 2026 17:48
@github-actions github-actions bot added the python For content related to the Python version of LangChain projects label Apr 16, 2026
@github-actions
Copy link
Copy Markdown
Contributor

❌ Import check failed

This PR contains imports from langchain_core that should be imported from langchain instead.

Detailed issues
Analyzing diff for import issues...
 Found 1 import issues:

File: src/code-samples/deepagents/skills-sandbox.py
Line: 13
Issue: Import from langchain.chat_models instead of langchain_core.language_models
Current:   from langchain_core.language_models import BaseChatModel
Suggested: from langchain.chat_models import BaseChatModel
--------------------------------------------------------------------------------

 Found 1 import issues that need to be fixed.

Why this is a problem

The langchain package re-exports many modules and classes from langchain_core. When possible, imports should use langchain instead of langchain_core for:

  • Better user experience (single import source)
  • Consistency across documentation
  • Reduced cognitive load for users

How to fix

Replace the imports as suggested above. For example:

  • from langchain_core.messages import HumanMessage
  • from langchain.messages import HumanMessage

🤖 Automated check

This check is based on the latest analysis of langchain re-exports from langchain_core.

@github-actions
Copy link
Copy Markdown
Contributor

Mintlify preview ID generated: preview-naomid-1776361822-1e67918

@npentrel Naomi Pentrel (npentrel) force-pushed the naomi/doc-925-change-langchain-quickstart branch from 4fe0b57 to 28e2ac3 Compare April 16, 2026 17:52
@github-actions github-actions bot removed the python For content related to the Python version of LangChain projects label Apr 16, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Mintlify preview ID generated: preview-naomid-1776362063-a92ddda

@github-actions
Copy link
Copy Markdown
Contributor

Mintlify preview ID generated: preview-naomid-1776417660-b4d4d36

2. A standard message content format: Model APIs evolved from returning messages with a simple content string to more complex output types - reasoning blocks, citations, server-side tool calls, etc. LangChain evolved its message formats to standardize these across providers.
</Update>

<Update label="2026-03-15">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This date is incorrect;

0.0.1 was published Jul 29, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I based this on when we announced it to the world. Though it's also possible we don't want this here at all until v1.0. vivek (@vtrivedy) what do you think?

<Update label="2026-03-15">
**Deep Agents is released** as an open-source agent harness built on LangGraph.

While LangChain provides flexible building blocks for custom agent architectures, [Deep Agents](/oss/langchain/overview) offers a batteries-included option for complex, long-running tasks like research and coding. It adds built-in planning tools, a virtual filesystem with pluggable backends (in-memory, disk, LangGraph store, sandboxes), subagent spawning for context isolation, and a terminal CLI. Use Deep Agents for more autonomous agents with predefined tools; use LangChain for full control over your agent architecture.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not sure we should mention CLI

</Tip>

## Requirements
## Install dependencies
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this makes me think; do we need a dedicated install page? https://docs.langchain.com/oss/python/langchain/install

can we fold these together or remove the install section from this page?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

let's do that separately. This PR is opening a big enough can of worms as it is :)

# Requires Python 3.10+
```

```bash pip
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if we're going to show pip we should show steps for creating a venv (same as we do for uv)

uv init
uv add langchain deepagents
uv sync
# Requires Python 3.10+
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

idk if we need these python version comments any more

result = agent.invoke(
{"messages": [{"role": "user", "content": "What's the weather in San Francisco?"}]}
)
print(result["messages"][-1].content)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should be using .content_blocks

:::

When you run the code and prompt the agent to tell you about the weather in San Francisco, the agent uses that input and its available context.
The agent understands that you are asking about the weather for the city San Francisco and therefore calls the weather tool with the provided city name. This is how you get the response `"It's always sunny in San Francisco!"`.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we mention the response but never show it (i don't think we need the final sentence)

When you run the code and prompt the agent to tell you about the weather in San Francisco, the agent uses that input and its available context.
The agent understands that you are asking about the weather for the city San Francisco and therefore calls the weather tool with the provided city name. This is how you get the response `"It's always sunny in San Francisco!"`.

<Tip>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i think we should just fold this into the "other" tab

if we're keeping it i think it should be less ambiguous


Now assemble your agent with all the components and run it.

There are two different frameworks for creating agents: LangChain agents and deep agents.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should always be capitalized right?

Suggested change
There are two different frameworks for creating agents: LangChain agents and deep agents.
There are two different frameworks for creating agents: LangChain agents and Deep Agents.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal langchain For docs changes to LangChain oss

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants