Skip to content
Back to skills

Langchain Knowledge Patch

BSecurity

LangChain

  • 25 stars
  • 0 votes
  • 0 copies
  • 6 views
  • Added September 5, 2026
ai-agentsjavascriptpythongojavanodegitapibackend

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 9 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-nevaberry-plugins/badge)](https://www.skillsdirectory.com/skills/nevaberry-langchain-knowledge-patch-nevaberry-plugins)

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 Compatibility Guidance

Load this skill when migrating LangChain packages or working with agents,
middleware, tools, provider integrations, Deep Agents, MCP, or LangGraph.
Use the topic references for complete API details and examples.

## Reference index

| Reference | Topics |
| --- | --- |
| [Package migration and core types](references/v1-migration.md) | Python and Core requirements, JavaScript packages, Google integration deprecations, content blocks, provider tools, core tracing |
| [Agents and tools](references/agents-and-tools.md) | Model routing, prompts, structured output, runtime tools, middleware, summarization, approvals, PII, tracing |
| [Anthropic integration](references/anthropic.md) | Native schemas, tool definitions and discovery, streaming, code execution, citations, MCP, caching, compaction |
| [OpenAI integration](references/openai.md) | Custom tools, structured answers, search, computer use, code interpreter, MCP approvals, response continuation, multimodal messages, moderation |
| [Deep Agents](references/deep-agents.md) | Harness defaults, middleware replacement, backends, filesystem changes, binary files, delta checkpoints, sandboxes, CLI |
| [LangGraph workflows](references/langgraph-workflows.md) | Node timeouts and recovery, graceful shutdown, stream projections, invocation results, JavaScript state schemas |
| [MCP adapters](references/mcp.md) | Integrated adapter migration, authentication, metadata, interceptors, resources, prompts, callbacks, elicitation |

## Migration and compatibility checks

### Python and Core 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. LangChain 1.4.9 requires `langchain-core>=1.7.5`
for handling standardized model-refusal content blocks.

### 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. Move `langchain/chains` imports to
`@langchain/classic/chains`.

### Python MCP 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 for `create_agent`.
Importing the beta namespace raises `LangChainBetaWarning`.
LangChain 1.4.4 raises the FastMCP minimum to `4.0.11`; update older pins.

### Deep Agents harness and backend migration

In Deep Agents 0.7, the authored base prompt starts empty; the default harness
omits `write_todos`, the `todos` state channel, and planning instructions.
Restore them with `create_deep_agent(..., middleware=[TodoListMiddleware()])`;
a harness profile can also opt in.

Pass concrete `BackendProtocol` instances and an explicit `namespace` for
`StoreBackend`. Use `ls`, `glob`, `grep`, and `ReadResult`; `BackendFactory`,
`BACKEND_TYPES`, `FileFormat`, and `Unset` were removed in Deep Agents 0.7.
New `FileData.content` values are strings. Existing `list[str]` content remains
readable and converts on the next write.

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.
See the Deep Agents reference for filesystem output and JavaScript backend changes.

### Delta checkpoint compatibility

Deep Agents 0.6 uses `DeltaChannel` 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: older releases cannot reconstruct delta checkpoints.

### Google integration deprecations

`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.

## Agent models, structured output, and tools

### Unbound models and strict output

Pass unbound chat models to `create_agent` when using `response_format`.
Middleware switching models with `request.override(model=...)` must also supply
an unbound model so the agent can configure 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 `strict`. The JavaScript structured-output tool strategy's
`handleErrors` controls schema parsing failures and responses making multiple
structured-output tool calls. Checkpointed agents clear the previous turn's
`structured_response` before producing the current turn's result.

### Runtime-discovered tools

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

### Injected runtime and tool failures

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.
Pass `state_schema` to `@wrap_tool_call` for custom state in function-style hooks.

By default, `ToolNode` turns tool invocation errors into tool messages and
re-raises errors from tool execution. `ToolNode(tools, handle_tool_errors=True)`
returns an error message for either kind of failure. The `end` behavior of
`ToolCallLimitMiddleware` terminates with recorded tool calls paired with results.

### Model routing and JavaScript prompts

LangChain 1.5.0 adds agent middleware for model routing and auto mode;
`ModelRouterMiddleware` is beta. LangChain 1.4.3 sanitizes cache settings when
switching to a fallback model.

In JavaScript `wrapModelCall`, use `handler(request.replace(model, tools))`
to change the model and tool list for that call. Middleware can choose using
`request.runtime.context` with the agent's `contextSchema`.
`createAgent` accepts a `SystemMessage` as `systemPrompt`, and
`SystemMessage.concat` extends it. Strings and `SystemMessage` instances from
`dynamicSystemPromptMiddleware` merge into the existing prompt.

## Summarization, approvals, and tracing

### Summarization behavior

JavaScript `summarizationMiddleware` accepts `trigger: { tokens: ... }`.
The summarization middleware uses the chat model's capability profile to
evaluate its trigger and decide how to summarize. `SummarizationMiddleware`
preserves conversation history if the summary call fails.
In 1.4.4, it retries when the summary request itself exceeds the context window;
in 1.4.5, `summarizer=` supplies custom summarization logic.

### Approval and human-edit behavior

A human-in-the-loop approval gate blocks the gated action if the approval
check fails. In 1.4.2, a human edit preserves the original model-generated
tool call in the conversation, and the resulting `ToolMessage` includes an edit
notice. In 1.4.6, middleware can opt in to a separate interrupt for each tool
call requiring approval. In 1.5.2, synthetic approval tool messages gain source
metadata so consumers can identify them.

### Moderation, PII, and trace visibility

Content moderation middleware can check tool results alongside user input and
model responses. JavaScript `piiRedactionMiddleware` redacts selected sensitive
data categories before the model call; custom Python detectors can import
`PIIMatch` with `from langchain.agents.middleware import PIIMatch`.
Middleware authors can configure tracing with `AgentMiddleware.trace_policy`.
Starting in 1.4.10, `ModelRefusalMiddleware` omits its inputs from traces.

## Provider context and output handling

### Anthropic schemas and context

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. `model.bind_tools(tools, strict=True)`
enforces ordinary tool input schemas and rejects unsupported schema features with HTTP 400.

With `langchain-anthropic>=1.3.0` and a supported model, set
`betas=["compact-2026-01-12"]` and configure the `compact_20260112` edit as `context_management`.
Preserve returned compaction blocks in subsequent message history.
See the Anthropic reference for the edit configuration, cache placement and TTL,
tool discovery, code execution, citations, and streaming argument assembly.

### OpenAI response continuation and compaction

Set `ChatOpenAI(model=model_id, use_previous_response_id=True)` and keep passing
message history. The integration uses the last response ID as `previous_response_id`
and sends only messages after that response. Prior input still counts toward billing.

Set `context_management=[{"type": "compaction", "compact_threshold": 100_000}]`
on `ChatOpenAI` for compaction at a token threshold. Keep returned `compaction`
blocks when passing history forward; you can drop messages before the latest item.
See the OpenAI reference for tool search, structured answers alongside tool calls,
provider-tool results, PDF filenames, audio replay, and prompt cache keys.

## Graph execution and streaming

### Node recovery and shutdown

For async nodes, `timeout=TimeoutPolicy(run_timeout=30, idle_timeout=5)` on
`StateGraph.add_node` sets a 30-second per-attempt limit and a 5-second idle
limit that resets on progress. `NodeTimeoutError` clears writes from that attempt
before retry policy runs. An `error_handler=recover` handles failures after
retries are exhausted and can return `Command(update=..., goto=...)`.
`RunControl.request_drain()` stops after the current superstep and saves a
resumable checkpoint; the run raises `GraphDrained` and can resume with the same configuration.

### Stream result shapes

Python `stream` and `astream` with `version="v2"` yield `StreamPart` dictionaries
with `type`, `ns`, and `data`. With that option, `invoke` and `ainvoke` return
`GraphOutput` with `.value` and `.interrupts`.
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 streaming `messages` projection omits model calls made internally by middleware.
Stream consumers updated in 1.4.7 read incremental `tool-call-delta` entries.
See the workflow reference for Python 3.10 callback forwarding, JavaScript
stream reconnection and interrupts, and JavaScript state schemas.

Files in this skill

  • SKILL.md9.2 KB
  • coverage.json1.4 KB
  • references/agents-and-tools.md9.1 KB
  • references/anthropic.md5.8 KB
  • references/deep-agents.md4.2 KB
  • references/langgraph-workflows.md3.6 KB
  • references/mcp.md3.1 KB
  • references/openai.md6.5 KB
  • references/v1-migration.md4.2 KB

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 ai-agents →

Comments

Loading comments…

Newsletter

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