langchain

Build production-ready LLM applications with chains, agents, memory, tools, and RAG pipelines using the LangChain framework

5 stars

Best use case

langchain is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Build production-ready LLM applications with chains, agents, memory, tools, and RAG pipelines using the LangChain framework

Teams using langchain should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/langchain/SKILL.md --create-dirs "https://raw.githubusercontent.com/vamseeachanta/workspace-hub/main/.agents/skills/ai/prompting/langchain/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/langchain/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How langchain Compares

Feature / AgentlangchainStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Build production-ready LLM applications with chains, agents, memory, tools, and RAG pipelines using the LangChain framework

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Langchain

## Quick Start

```bash
# Install LangChain ecosystem
pip install langchain langchain-openai langchain-community langchain-core

# Install vector store dependencies
pip install chromadb faiss-cpu

# Install document loaders
pip install unstructured pypdf docx2txt

# Set API key
export OPENAI_API_KEY="your-api-key"
```

## When to Use This Skill

**USE when:**
- Building complex LLM applications with multiple components
- Need agents that can use tools and make autonomous decisions
- Implementing RAG (Retrieval Augmented Generation) systems
- Integrating with various LLM providers (OpenAI, Anthropic, local models)
- Building chatbots with conversation memory
- Processing and querying document collections
- Need streaming responses for real-time applications
- Orchestrating multi-step reasoning workflows

**DON'T USE when:**
- Simple single-prompt LLM calls (use direct API)
- Optimizing prompts programmatically (use DSPy instead)
- Building UI-focused chat applications (use Streamlit/Gradio directly)
- Need minimal dependencies and maximum control
- Performance-critical applications requiring custom optimizations

## Prerequisites

```bash
# Core installation
pip install langchain>=0.2.0 langchain-openai>=0.1.0 langchain-core>=0.2.0

# For RAG applications
pip install chromadb>=0.4.0 faiss-cpu>=1.7.0

# For document processing
pip install unstructured>=0.10.0 pypdf>=3.0.0

# For web search and tools
pip install duckduckgo-search wikipedia arxiv

# Optional: Local LLMs
pip install langchain-community ollama

# Environment setup
export OPENAI_API_KEY="sk-..."
export ANTHROPIC_API_KEY="sk-ant-..."
```

## Complete Examples

### Example 1: Engineering Documentation Assistant

```python
from langchain_openai import ChatOpenAI, OpenAIEmbeddings
from langchain_community.vectorstores import Chroma
from langchain_community.document_loaders import DirectoryLoader, PyPDFLoader
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
from langchain_core.runnables import RunnablePassthrough
from langchain_core.runnables.history import RunnableWithMessageHistory
from langchain_community.chat_message_histories import ChatMessageHistory
from pathlib import Path

*See sub-skills for full details.*
### Example 2: Multi-Tool Research Agent

```python
from langchain_openai import ChatOpenAI
from langchain.agents import AgentExecutor, create_openai_tools_agent
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
from langchain_core.tools import tool
from langchain_community.tools import DuckDuckGoSearchRun, WikipediaQueryRun
from langchain_community.utilities import WikipediaAPIWrapper
from pydantic import BaseModel, Field
from typing import List, Optional
import json

*See sub-skills for full details.*

## Integration Patterns

### LangServe Deployment

```python
from fastapi import FastAPI
from langserve import add_routes
from langchain_openai import ChatOpenAI
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.output_parsers import StrOutputParser

# Create app
app = FastAPI(
    title="Engineering Assistant API",

*See sub-skills for full details.*
### LangSmith Tracing

```python
import os
from langchain_openai import ChatOpenAI
from langchain_core.prompts import ChatPromptTemplate

# Enable LangSmith tracing
os.environ["LANGCHAIN_TRACING_V2"] = "true"
os.environ["LANGCHAIN_API_KEY"] = "your-langsmith-api-key"
os.environ["LANGCHAIN_PROJECT"] = "engineering-assistant"

# All chain invocations are now traced
chain = ChatPromptTemplate.from_template("{input}") | ChatOpenAI()
response = chain.invoke({"input": "Hello"})
```

## Resources

- **LangChain Documentation**: https://python.langchain.com/docs/
- **LangChain Expression Language**: https://python.langchain.com/docs/expression_language/
- **LangSmith**: https://smith.langchain.com/
- **LangServe**: https://python.langchain.com/docs/langserve/

---

## Version History

- **1.0.0** (2026-01-17): Initial release with chains, agents, memory, RAG, and streaming

## Sub-Skills

- [1. Basic Chain Composition](1-basic-chain-composition/SKILL.md)
- [2. Agent with Tools](2-agent-with-tools/SKILL.md)
- [3. Conversation Memory](3-conversation-memory/SKILL.md)
- [4. RAG (Retrieval Augmented Generation)](4-rag-retrieval-augmented-generation/SKILL.md)
- [5. Document Processing](5-document-processing/SKILL.md)
- [6. Streaming Responses](6-streaming-responses/SKILL.md)
- [1. Error Handling (+2)](1-error-handling/SKILL.md)
- [Rate Limit Errors (+2)](rate-limit-errors/SKILL.md)

Related Skills

pyproject-toml

5
from vamseeachanta/workspace-hub

Configure Python projects with pyproject.toml for modern packaging, tools, and dependency management

python-scientific-computing

5
from vamseeachanta/workspace-hub

Python for engineering analysis, numerical computing, and scientific workflows using NumPy, SciPy, SymPy

pandas-data-processing

5
from vamseeachanta/workspace-hub

Pandas for time series analysis, OrcaFlex results processing, and marine engineering data workflows

numpy-numerical-analysis

5
from vamseeachanta/workspace-hub

NumPy for matrix operations, FFT, linear algebra, and numerical computations in marine engineering

docx-templates

5
from vamseeachanta/workspace-hub

Template-based Word document generation using Jinja2 syntax. Create reports, contracts, and documents with loops, conditionals, tables, and mail merge capabilities.

ydata-profiling

5
from vamseeachanta/workspace-hub

Automated data quality reports with comprehensive variable analysis, missing value detection, correlations, and HTML report generation - formerly pandas-profiling

sweetviz

5
from vamseeachanta/workspace-hub

Automated EDA comparison reports with target analysis, feature comparison, and HTML report generation for pandas DataFrames

great-tables

5
from vamseeachanta/workspace-hub

Publication-quality tables in Python with rich styling, formatting, conditional formatting, and export to HTML/images - inspired by R's gt package

bsee-sodir-extraction

5
from vamseeachanta/workspace-hub

Extract and process energy data from BSEE (Gulf of Mexico) and SODIR (Norway) regulatory databases

autoviz

5
from vamseeachanta/workspace-hub

Automatic exploratory data analysis and visualization with a single line of code - generates comprehensive charts, detects patterns, and exports to HTML/notebooks

pandasai

5
from vamseeachanta/workspace-hub

Conversational data analysis using natural language queries on pandas DataFrames. Use when you want to ask plain-English questions about data, generate charts, explain transformations, or build exploratory analysis interfaces — all powered by an LLM backend. Supports OpenAI, Anthropic, Google Gemini, Azure OpenAI, and local models. Handles single DataFrames (SmartDataframe) and multi-table joins (SmartDatalake).

langchain-rate-limit-errors

5
from vamseeachanta/workspace-hub

Sub-skill of langchain: Rate Limit Errors (+2).