Skip to content
Back to skills

Langchain Knowledge Patch

BSecurity

LangChain

  • 25 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added May 27, 2026
data-aijavascripttypescriptpythongojavanodegitapibackend

Works with

  • cli
  • api
  • mcp

Security analysis

B84/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 6 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill langchain-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Langchain Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Langchain Knowledge Patch
[![Security: B — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-langchain-knowledge-patch/badge)](https://www.skillsdirectory.com/skills/nevaberry-langchain-knowledge-patch)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: langchain-knowledge-patch
description: LangChain
version: "1.5.2"
license: MIT
metadata:
  author: Nevaberry
---


# LangChain Knowledge Patch

Load this skill when migrating LangChain packages or working with agents,
middleware, tools, structured output, provider integrations, MCP, Deep Agents,
or LangGraph workflows in Python, TypeScript, or JavaScript.

Use the references for complete guidance, provider requirements, and examples.

## References

| Reference | Topics |
| --- | --- |
| [v1 Migration and Core Types](references/v1-migration.md) | Package migration, Python and Core requirements, content blocks, provider integrations, core tracing |
| [Agents, Middleware, Tools, State, and Runtime](references/agents-and-tools.md) | Structured output, model selection, runtime tools, summarization, approvals, content controls, tracing |
| [Anthropic Integration](references/anthropic.md) | Schemas, tool execution, discovery, citations, caching, compaction, token usage |
| [OpenAI Integration](references/openai.md) | Responses API tools, structured answers, search, multimodal content, continuation, caching |
| [MCP Adapters and Workflows](references/mcp.md) | Adapter migration, authentication, results, resources, prompts, interceptors, callbacks, elicitation |
| [Deep Agents](references/deep-agents.md) | Harness defaults, middleware replacement, backends, files, CLI, subagents, sandboxes, summarization |
| [LangGraph State, Execution, and Streaming](references/langgraph-workflows.md) | State schemas, delta checkpoints, timeouts, recovery, shutdown, stream projections, interrupts |

## Migrations and compatibility

### JavaScript package migration

Install or upgrade with `npm install langchain @langchain/core`. Install `@langchain/classic` for
legacy chains, retrievers, the indexing API, and former community re-exports. Imports from
`langchain/chains` move to `@langchain/classic/chains`.

### Python and Core version requirements

LangChain 1.5.0 requires Python 3.11 or later and `langchain-core>=1.8.0`. On Python 3.10, the last
supported series are `langchain` 1.4.x and `langchain-core` 1.7.x.

### Python MCP package migration

LangChain 1.4 replaces `MultiServerMCPClient` from `langchain-mcp-adapters` with `MCPAdapter` from
`langchain.mcp`. Install with `pip install "langchain[mcp]"` and use `await
MCPAdapter(target).list_tools()` for tools ready to pass to `create_agent`. The adapter infers the
transport from a URL, a local stdio script, an in-process server, a multiserver `MCPConfig`, or a
`fastmcp.Client`. Importing the beta namespace raises `LangChainBetaWarning`.

### FastMCP minimum version

LangChain 1.4.4 raises the FastMCP minimum to `4.0.11`. Update older FastMCP pins when upgrading the
MCP integration.

### Consolidated Python generative AI integration

`langchain-google-genai` 4.0 supports the direct API and the enterprise agent platform through the
same SDK interface. Check the [migration
guide](https://github.com/langchain-ai/langchain-google/discussions/1422) when upgrading code that
imports from `langchain-google-vertexai`, where the release introduces deprecations.

### Deep Agents 0.7 backend migration

Pass concrete `BackendProtocol` instances, supply an explicit `namespace` for `StoreBackend`, and
use `ls`, `glob`, `grep`, and `ReadResult`. The old `BackendFactory`, `BACKEND_TYPES`, `FileFormat`,
and `Unset` symbols were removed. New `FileData.content` values are strings. Existing `list[str]`
content remains readable and converts on the next write.

### Deep Agents filesystem permissions and writes

In Deep Agents 0.7, `write_file` overwrites existing files, and `delete` can remove files and
recursively remove directories. Use the `FilesystemMiddleware` tool allowlist to expose only the
built-in tools the agent needs.

### Deep Agents 0.7 prompt and planning defaults

The authored base prompt starts empty, and the default harness omits the `write_todos` tool, `todos`
state channel, and planning instructions. Restore them with `create_deep_agent(...,
middleware=[TodoListMiddleware()])`. A harness profile can also opt in.

### Delta checkpoint compatibility

`DeltaChannel` stores incremental writes, and `snapshot_frequency=K` saves a full snapshot every `K`
steps. Deep Agents 0.6 uses this format for messages and files. Before downgrading, migrate
persisted threads with
[`delta-channel-dump`](https://github.com/langchain-ai/langgraph/tree/main/examples/delta-channel-dump)
or discard them, since older releases cannot reconstruct delta checkpoints.

## Agents, tools, and structured output

### Model binding with structured output

Pass unbound chat models to `create_agent` when using `response_format`. Middleware that switches
models with `request.override(model=...)` must also supply an unbound model so the agent can
configure structured output.

### Runtime-discovered tools

Expose a discovered tool to the model through `request.override(tools=...)` in `wrap_model_call`.
For execution, match the requested name in `wrap_tool_call` and pass the tool to the handler through
`request.override(tool=...)`. Tools registered at agent creation can be filtered in the model hook
alone.

### Injected tool runtime

Declare `runtime: ToolRuntime` from `langchain.tools` to receive `state`, `context`, `store`,
`config`, `stream_writer`, and `tool_call_id` in an agent or `ToolNode` tool. The injected parameter
is hidden from the model's schema. Keep `runtime` and `config` reserved for framework injection in
tool signatures.

### ToolNode error handling

By default, `ToolNode` turns tool invocation errors into tool messages and re-raises errors from
tool execution. Set `ToolNode(tools, handle_tool_errors=True)` to return an error message for either
kind of failure. A string supplies a fixed message, an exception-type tuple selects which exceptions
to catch, and a callable can format the message for its annotated exception type.

### Agent-level strict structured output

In Python, pass `response_format=ProviderStrategy(schema=Answer, strict=True)` to `create_agent` for
provider-enforced schema adherence on supported models. JavaScript's `providerStrategy` also exposes
a `strict` option.

### JavaScript structured-output errors

The structured-output tool strategy's `handleErrors` option controls both schema parsing failures
and responses that make multiple structured-output tool calls.

### Approval gate failures

A human-in-the-loop approval gate blocks the gated action if the approval check fails.

### Model routing and auto mode

LangChain 1.5.0 adds agent middleware for model routing and auto mode. `ModelRouterMiddleware` is
beta.

## Middleware and conversation history

### JavaScript middleware request replacement

In `wrapModelCall`, call `handler(request.replace(model, tools))` to change the model and tool list
for that call. Middleware can make that choice using `request.runtime.context` with the agent's
`contextSchema`.

### JavaScript token-triggered summarization

Set `trigger: { tokens: ... }` when adding `summarizationMiddleware` to summarize conversation
history once it reaches a token threshold.

### History preservation on summarization failure

`SummarizationMiddleware` preserves the conversation history if the summary call fails.

### Custom summarizer

In 1.4.5, pass `summarizer=` to `SummarizationMiddleware` to supply custom summarization logic.

### Additive JavaScript system prompts

`createAgent` accepts a `SystemMessage` as `systemPrompt`, and `SystemMessage.concat` extends a
system message. Strings and `SystemMessage` instances returned by `dynamicSystemPromptMiddleware`
are merged into the existing prompt, so multiple middleware can add instructions.

## Provider integrations

### Native schema enforcement

On supported models with `langchain-anthropic>=1.1.0`, use `model.with_structured_output(Schema,
method="json_schema")` for native JSON schema output. The default method uses function calling. For
ordinary tool calls, `model.bind_tools(tools, strict=True)` enforces the tool input schema and
rejects unsupported schema features with HTTP 400.

### OpenAI structured answers alongside tool calls

Bind ordinary tools and a Pydantic output schema together with `llm.bind_tools([lookup],
response_format=Answer, strict=True)`. A turn can return `response.tool_calls` or a structured
answer in `response.additional_kwargs["parsed"]`.

### Server-side tool search

With `langchain-openai>=1.1.11`, add `{"type": "tool_search"}` alongside tools marked with
`@tool(extras={"defer_loading": True})` in a Responses API agent. Discovery can return a tool
definition and a call to that tool in the same response.

## MCP results and graph execution

### Structured MCP tool results

The adapter places the server's `structuredContent` in an `MCPToolArtifact` under
`ToolMessage.artifact["structured_content"]`. To expose it to the model, have an interceptor
serialize the raw result's `structuredContent` and append it to `result.content` as an
`mcp.types.TextContent` block.

### Python LangGraph node timeouts

On async nodes, pass `timeout=TimeoutPolicy(run_timeout=30, idle_timeout=5)` to
`StateGraph.add_node` for a 30-second per-attempt limit and a 5-second idle limit that resets on
progress. A `NodeTimeoutError` clears writes from that attempt before the retry policy runs.

### Python v3 event stream projections

LangGraph 1.2, LangChain 1.3 agents, and Deep Agents 0.6 support the beta `stream_events(...,
version="v3")` and `astream_events(..., version="v3")` protocols. The returned run exposes
`.values`, `.messages`, `.lifecycle`, and `.subgraphs`. The `.messages` projection yields one
`ChatModelStream` per model call, with separate projections for text, reasoning, tool calls, and
usage.

Files in this skill

  • SKILL.md7.2 KB
  • references/agent-creation.md1.5 KB
  • references/content-and-output.md1.6 KB
  • references/middleware.md2.8 KB
  • references/namespace-and-migration.md1.5 KB
  • references/tools-and-runtime.md643 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in data-ai →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.