LangChain Integration
Use deepseek-kit alongside LangChain.js — DeepSeek handles text reasoning and tool calling while LangChain handles multimodal and complex workflows.
LangChain.js is a feature-rich AI application development framework providing a complete ecosystem of agents, tools, middleware, memory systems, and more. By integrating deepseek-kit with LangChain, you can leverage LangChain's multimodal support, pre-built tools, and state management capabilities while enjoying DeepSeek's cost-effective text reasoning.
Installation
Pattern 1: deepseek-kit as a LangChain Subagent
Wrap deepseek-kit agents as LangChain tools, using them as subagents within LangChain's createAgent. The LangChain main agent handles multimodal understanding and task orchestration, while DeepSeek subagents handle deep text reasoning.
Scenario: Multimodal Input + Text Research
Scenario: Code Review Pipeline
LangChain orchestrates a multi-step workflow, while DeepSeek handles the specific code analysis and review:
Pattern 2: LangChain as a deepseek-kit Subagent
Wrap LangChain's capabilities as deepseek-kit tools, calling them on demand within a deepseek-kit agent.
Scenario: Image Understanding + Text Reasoning
The DeepSeek agent serves as the primary controller, calling LangChain's multimodal model when image understanding is needed:
Scenario: Using LangChain Pre-built Tools
LangChain provides a rich set of pre-built tools (web search, database queries, etc.) that can be directly wrapped as deepseek-kit tools:
Hybrid Architecture Example
Here's a complete hybrid architecture example — LangChain handles user interaction and multimodal input, while DeepSeek handles text-intensive tasks:
Considerations
- Context Isolation — deepseek-kit subagents have their own isolated context window. If you need to pass the LangChain main agent's conversation history, manually construct the messages in the tool's
executefunction - Tool Format Differences — deepseek-kit's
tool()and LangChain'stool()use different parameter formats and are not directly interchangeable. Adaptation is needed at the integration layer - Error Handling — Errors from deepseek-kit subagents are returned to the LangChain main agent as tool execution failures. You can handle these errors uniformly in LangChain's middleware
- API Keys — Make sure both
DEEPSEEK_API_KEYand the corresponding LangChain model's API key (e.g.,OPENAI_API_KEY) are configured - Streaming — deepseek-kit subagent internal stream events don't propagate to LangChain's stream. If you need to display progress, handle it within the tool itself

