Skip to content

Conversation

sydney-runkle
Copy link
Contributor

@sydney-runkle sydney-runkle commented Oct 13, 2025

removing v0 content

@Copilot Copilot AI review requested due to automatic review settings October 13, 2025 15:38
@github-actions github-actions bot added langchain For docs changes to LangChain oss labels Oct 13, 2025
Copy link
Contributor

@Copilot 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

This PR modernizes LangChain's documentation by removing outdated v0 content and updating it to reflect the current middleware-based architecture. The changes reorganize content to improve user experience and maintain consistency across documentation sections.

Key changes:

  • Refactored middleware patterns from legacy hooks to modern decorator and class-based approaches
  • Moved "Create tools" section from beginning to end in tools documentation for better information flow
  • Updated API patterns throughout multiple files to use current middleware architecture

Reviewed Changes

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

Show a summary per file
File Description
src/oss/langchain/tools.mdx Moved "Create tools" section to end and expanded agent data access content
src/oss/langchain/short-term-memory.mdx Updated state management and hooks to use middleware patterns
src/oss/langchain/runtime.mdx Modernized runtime access examples to use middleware instead of hooks
src/oss/langchain/rag.mdx Added missing state_schema property to middleware class
src/oss/langchain/middleware.mdx Reorganized decorator and class-based middleware sections
src/oss/langchain/context-engineering.mdx Complete rewrite to focus on practical middleware-based patterns
src/oss/langchain/agents.mdx Added middleware references and updated hook descriptions

Copy link
Contributor

Preview ID generated: preview-srchip-1760369918-75ab621

Copy link
Contributor

Preview ID generated: preview-srchip-1760371054-ce01201

@Copilot Copilot AI review requested due to automatic review settings October 13, 2025 16:10
Copy link
Contributor

@Copilot 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

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

Comments suppressed due to low confidence (2)

src/oss/langchain/short-term-memory.mdx:67

  • Missing closing bracket for the messages array in the JavaScript code.
});

src/oss/langchain/context-engineering.mdx:1

  • The function perform_search is referenced but not defined. This will cause a runtime error when the example is executed. Consider providing a placeholder implementation or noting that it's a stub function.
---

Copy link
Contributor

Preview ID generated: preview-srchip-1760371860-09bf38d

For more details on streaming, see [Streaming](/oss/langchain/streaming).
</Tip>

### Middleware
Copy link
Contributor Author

Choose a reason for hiding this comment

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

can add specific code examples here if we want, but I think middleware section makes more sense

@sydney-runkle sydney-runkle marked this pull request as draft October 13, 2025 16:37
Copy link
Contributor

Preview ID generated: preview-srchip-1760374199-c008c3d

Comment on lines 112 to 128
from langchain.agents import create_agent, AgentState
from langchain.agents.middleware import AgentMiddleware
from langgraph.checkpoint.memory import InMemorySaver

class CustomAgentState(AgentState): # [!code highlight]
user_id: str # [!code highlight]
preferences: dict # [!code highlight]

class StateExtensionMiddleware(AgentMiddleware[CustomAgentState]):
state_schema = CustomAgentState # [!code highlight]

agent = create_agent(
"openai:gpt-5",
[get_user_info],
state_schema=CustomAgentState, # [!code highlight]
middleware=[StateExtensionMiddleware()], # [!code highlight]
checkpointer=InMemorySaver(),
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This seems unfortunate to me :/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also not a great example of state extension? Both of these seem context-y?

from langchain_core.messages.utils import count_tokens_approximately
from langchain.agents import create_agent, AgentState
from langchain.agents import create_agent
from langchain.agents.middleware import SummarizationMiddleware
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice!

Copy link
Contributor

Preview ID generated: preview-srchip-1760375129-9bc72ff

Copy link
Contributor

Preview ID generated: preview-srchip-1760375332-0ab38d5

Copy link
Contributor

Preview ID generated: preview-srchip-1760375536-7581bf7

Copy link
Contributor

Preview ID generated: preview-srchip-1760375669-afa4ae5

Copy link
Contributor

Preview ID generated: preview-srchip-1760406357-8eda49f

Copy link
Contributor

Preview ID generated: preview-srchip-1760406558-ab7c31b

@sydney-runkle sydney-runkle marked this pull request as ready for review October 14, 2025 01:53
@Copilot Copilot AI review requested due to automatic review settings October 14, 2025 01:54
Copy link
Contributor

@Copilot 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

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

src/oss/langchain/middleware.mdx:1

  • The unreachable return statement has been removed, but the exception handling logic is still incomplete. The retry should continue to the next iteration within the loop rather than falling through.
---

src/oss/langchain/context-engineering.mdx:1

  • The function perform_search is referenced but not defined. This appears to be a placeholder that should either be implemented or marked as a conceptual example.
---

}
return None

# Wrap-style: retry logic
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't know if "wrap-style" would make sense to folks


## Decorator-based middleware

For simple middleware that only needs a single hook, decorators provide the quickest way to add functionality:
Copy link
Collaborator

Choose a reason for hiding this comment

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

This might work better as tabs or separate snippets, not sure, but code block is long

@sydney-runkle sydney-runkle merged commit f675574 into main Oct 14, 2025
12 checks passed
@sydney-runkle sydney-runkle deleted the sr/chipping-at-v1-pages branch October 14, 2025 02:03
mdrxy pushed a commit that referenced this pull request Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

langchain For docs changes to LangChain oss

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants