[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M73AERGBF7VZAY3MF63MHK79":3,"skill-same:01M73AERGBF7VZAY3MF63MHK79":77},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":41,"commitSha":42,"skillDirectory":43,"forksCount":44,"repositoryHtmlUrl":45,"repositoryHomepageUrl":6,"ownerHtmlUrl":46,"ownerBlogUrl":47,"ownerDescription":6,"updatedAt":48,"install":49,"resources":62},"01M73AERGBF7VZAY3MF63MHK79","langchain",null,"Framework for building LLM-powered applications with agents, chains, and RAG. Supports multiple providers (OpenAI, Anthropic, Google), 500+ integrations, ReAct agents, tool calling, memory management, and vector store retrieval. Use for building chatbots, question-answering systems, autonomous agents, or RAG applications. Best for rapid prototyping and production deployments.","qhjqhj00\u002Fresearch-skills-pool","qhjqhj00","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F29684092?v=4","01M72AE0ZGXVM5C57N512DGQG8","Tommy Chien","01M72AE107ESJMHT7QC5SXX144",3,"MIT","https:\u002F\u002Fgithub.com\u002Fqhjqhj00\u002Fresearch-skills-pool\u002Fblob\u002Fmaster\u002Fskills_collected\u002FOrchestra-Research--AI-research-SKILLs--14-agents__langchain\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: langchain\ndescription: Framework for building LLM-powered applications with agents, chains, and RAG. Supports multiple providers (OpenAI, Anthropic, Google), 500+ integrations, ReAct agents, tool calling, memory management, and vector store retrieval. Use for building chatbots, question-answering systems, autonomous agents, or RAG applications. Best for rapid prototyping and production deployments.\nversion: 1.0.0\nauthor: Orchestra Research\nlicense: MIT\ntags: [Agents, LangChain, RAG, Tool Calling, ReAct, Memory Management, Vector Stores, LLM Applications, Chatbots, Production]\ndependencies: [langchain, langchain-core, langchain-openai, langchain-anthropic]\n---\n\n# LangChain - Build LLM Applications with Agents & RAG\n\nThe most popular framework for building LLM-powered applications.\n\n## When to use LangChain\n\n**Use LangChain when:**\n- Building agents with tool calling and reasoning (ReAct pattern)\n- Implementing RAG (retrieval-augmented generation) pipelines\n- Need to swap LLM providers easily (OpenAI, Anthropic, Google)\n- Creating chatbots with conversation memory\n- Rapid prototyping of LLM applications\n- Production deployments with LangSmith observability\n\n**Metrics**:\n- **119,000+ GitHub stars**\n- **272,000+ repositories** use LangChain\n- **500+ integrations** (models, vector stores, tools)\n- **3,800+ contributors**\n\n**Use alternatives instead**:\n- **LlamaIndex**: RAG-focused, better for document Q&A\n- **LangGraph**: Complex stateful workflows, more control\n- **Haystack**: Production search pipelines\n- **Semantic Kernel**: Microsoft ecosystem\n\n## Quick start\n\n### Installation\n\n```bash\n# Core library (Python 3.10+)\npip install -U langchain\n\n# With OpenAI\npip install langchain-openai\n\n# With Anthropic\npip install langchain-anthropic\n\n# Common extras\npip install langchain-community  # 500+ integrations\npip install langchain-chroma     # Vector store\n```\n\n### Basic LLM usage\n\n```python\nfrom langchain_anthropic import ChatAnthropic\n\n# Initialize model\nllm = ChatAnthropic(model=\"claude-sonnet-4-5-20250929\")\n\n# Simple completion\nresponse = llm.invoke(\"Explain quantum computing in 2 sentences\")\nprint(response.content)\n```\n\n### Create an agent (ReAct pattern)\n\n```python\nfrom langchain.agents import create_agent\nfrom langchain_anthropic import ChatAnthropic\n\n# Define tools\ndef get_weather(city: str) -> str:\n    \"\"\"Get current weather for a city.\"\"\"\n    return f\"It's sunny in {city}, 72°F\"\n\ndef search_web(query: str) -> str:\n    \"\"\"Search the web for information.\"\"\"\n    return f\"Search results for: {query}\"\n\n# Create agent (\u003C10 lines!)\nagent = create_agent(\n    model=ChatAnthropic(model=\"claude-sonnet-4-5-20250929\"),\n    tools=[get_weather, search_web],\n    system_prompt=\"You are a helpful assistant. Use tools when needed.\"\n)\n\n# Run agent\nresult = agent.invoke({\"messages\": [{\"role\": \"user\", \"content\": \"What's the weather in Paris?\"}]})\nprint(result[\"messages\"][-1].content)\n```\n\n## Core concepts\n\n### 1. Models - LLM abstraction\n\n```python\nfrom langchain_openai import ChatOpenAI\nfrom langchain_anthropic import ChatAnthropic\nfrom langchain_google_genai import ChatGoogleGenerativeAI\n\n# Swap providers easily\nllm = ChatOpenAI(model=\"gpt-4o\")\nllm = ChatAnthropic(model=\"claude-sonnet-4-5-20250929\")\nllm = ChatGoogleGenerativeAI(model=\"gemini-2.0-flash-exp\")\n\n# Streaming\nfor chunk in llm.stream(\"Write a poem\"):\n    print(chunk.content, end=\"\", flush=True)\n```\n\n### 2. Chains - Sequential operations\n\n```python\nfrom langchain.chains import LLMChain\nfrom langchain.prompts import PromptTemplate\n\n# Define prompt template\nprompt = PromptTemplate(\n    input_variables=[\"topic\"],\n    template=\"Write a 3-sentence summary about {topic}\"\n)\n\n# Create chain\nchain = LLMChain(llm=llm, prompt=prompt)\n\n# Run chain\nresult = chain.run(topic=\"machine learning\")\n```\n\n### 3. Agents - Tool-using reasoning\n\n**ReAct (Reasoning + Acting) pattern:**\n\n```python\nfrom langchain.agents import create_tool_calling_agent, AgentExecutor\nfrom langchain.tools import Tool\n\n# Define custom tool\ncalculator = Tool(\n    name=\"Calculator\",\n    func=lambda x: eval(x),\n    description=\"Useful for math calculations. Input: valid Python expression.\"\n)\n\n# Create agent with tools\nagent = create_tool_calling_agent(\n    llm=llm,\n    tools=[calculator, search_web],\n    prompt=\"Answer questions using available tools\"\n)\n\n# Create executor\nagent_executor = AgentExecutor(agent=agent, tools=[calculator], verbose=True)\n\n# Run with reasoning\nresult = agent_executor.invoke({\"input\": \"What is 25 * 17 + 142?\"})\n```\n\n### 4. Memory - Conversation history\n\n```python\nfrom langchain.memory import ConversationBufferMemory\nfrom langchain.chains import ConversationChain\n\n# Add memory to track conversation\nmemory = ConversationBufferMemory()\n\nconversation = ConversationChain(\n    llm=llm,\n    memory=memory,\n    verbose=True\n)\n\n# Multi-turn conversation\nconversation.predict(input=\"Hi, I'm Alice\")\nconversation.predict(input=\"What's my name?\")  # Remembers \"Alice\"\n```\n\n## RAG (Retrieval-Augmented Generation)\n\n### Basic RAG pipeline\n\n```python\nfrom langchain_community.document_loaders import WebBaseLoader\nfrom langchain.text_splitter import RecursiveCharacterTextSplitter\nfrom langchain_openai import OpenAIEmbeddings\nfrom langchain_chroma import Chroma\nfrom langchain.chains import RetrievalQA\n\n# 1. Load documents\nloader = WebBaseLoader(\"https:\u002F\u002Fdocs.python.org\u002F3\u002Ftutorial\u002F\")\ndocs = loader.load()\n\n# 2. Split into chunks\ntext_splitter = RecursiveCharacterTextSplitter(\n    chunk_size=1000,\n    chunk_overlap=200\n)\nsplits = text_splitter.split_documents(docs)\n\n# 3. Create embeddings and vector store\nvectorstore = Chroma.from_documents(\n    documents=splits,\n    embedding=OpenAIEmbeddings()\n)\n\n# 4. Create retriever\nretriever = vectorstore.as_retriever(search_kwargs={\"k\": 4})\n\n# 5. Create QA chain\nqa_chain = RetrievalQA.from_chain_type(\n    llm=llm,\n    retriever=retriever,\n    return_source_documents=True\n)\n\n# 6. Query\nresult = qa_chain({\"query\": \"What are Python decorators?\"})\nprint(result[\"result\"])\nprint(f\"Sources: {result['source_documents']}\")\n```\n\n### Conversational RAG with memory\n\n```python\nfrom langchain.chains import ConversationalRetrievalChain\n\n# RAG with conversation memory\nqa = ConversationalRetrievalChain.from_llm(\n    llm=llm,\n    retriever=retriever,\n    memory=ConversationBufferMemory(\n        memory_key=\"chat_history\",\n        return_messages=True\n    )\n)\n\n# Multi-turn RAG\nqa({\"question\": \"What is Python used for?\"})\nqa({\"question\": \"Can you elaborate on web development?\"})  # Remembers context\n```\n\n## Advanced agent patterns\n\n### Structured output\n\n```python\nfrom langchain_core.pydantic_v1 import BaseModel, Field\n\n# Define schema\nclass WeatherReport(BaseModel):\n    city: str = Field(description=\"City name\")\n    temperature: float = Field(description=\"Temperature in Fahrenheit\")\n    condition: str = Field(description=\"Weather condition\")\n\n# Get structured response\nstructured_llm = llm.with_structured_output(WeatherReport)\nresult = structured_llm.invoke(\"What's the weather in SF? It's 65F and sunny\")\nprint(result.city, result.temperature, result.condition)\n```\n\n### Parallel tool execution\n\n```python\nfrom langchain.agents import create_tool_calling_agent\n\n# Agent automatically parallelizes independent tool calls\nagent = create_tool_calling_agent(\n    llm=llm,\n    tools=[get_weather, search_web, calculator]\n)\n\n# This will call get_weather(\"Paris\") and get_weather(\"London\") in parallel\nresult = agent.invoke({\n    \"messages\": [{\"role\": \"user\", \"content\": \"Compare weather in Paris and London\"}]\n})\n```\n\n### Streaming agent execution\n\n```python\n# Stream agent steps\nfor step in agent_executor.stream({\"input\": \"Research AI trends\"}):\n    if \"actions\" in step:\n        print(f\"Tool: {step['actions'][0].tool}\")\n    if \"output\" in step:\n        print(f\"Output: {step['output']}\")\n```\n\n## Common patterns\n\n### Multi-document QA\n\n```python\nfrom langchain.chains.qa_with_sources import load_qa_with_sources_chain\n\n# Load multiple documents\ndocs = [\n    loader.load(\"https:\u002F\u002Fdocs.python.org\"),\n    loader.load(\"https:\u002F\u002Fdocs.numpy.org\")\n]\n\n# QA with source citations\nchain = load_qa_with_sources_chain(llm, chain_type=\"stuff\")\nresult = chain({\"input_documents\": docs, \"question\": \"How to use numpy arrays?\"})\nprint(result[\"output_text\"])  # Includes source citations\n```\n\n### Custom tools with error handling\n\n```python\nfrom langchain.tools import tool\n\n@tool\ndef risky_operation(query: str) -> str:\n    \"\"\"Perform a risky operation that might fail.\"\"\"\n    try:\n        # Your operation here\n        result = perform_operation(query)\n        return f\"Success: {result}\"\n    except Exception as e:\n        return f\"Error: {str(e)}\"\n\n# Agent handles errors gracefully\nagent = create_agent(model=llm, tools=[risky_operation])\n```\n\n### LangSmith observability\n\n```python\nimport os\n\n# Enable tracing\nos.environ[\"LANGCHAIN_TRACING_V2\"] = \"true\"\nos.environ[\"LANGCHAIN_API_KEY\"] = \"your-api-key\"\nos.environ[\"LANGCHAIN_PROJECT\"] = \"my-project\"\n\n# All chains\u002Fagents automatically traced\nagent = create_agent(model=llm, tools=[calculator])\nresult = agent.invoke({\"input\": \"Calculate 123 * 456\"})\n\n# View traces at smith.langchain.com\n```\n\n## Vector stores\n\n### Chroma (local)\n\n```python\nfrom langchain_chroma import Chroma\n\nvectorstore = Chroma.from_documents(\n    documents=docs,\n    embedding=OpenAIEmbeddings(),\n    persist_directory=\".\u002Fchroma_db\"\n)\n```\n\n### Pinecone (cloud)\n\n```python\nfrom langchain_pinecone import PineconeVectorStore\n\nvectorstore = PineconeVectorStore.from_documents(\n    documents=docs,\n    embedding=OpenAIEmbeddings(),\n    index_name=\"my-index\"\n)\n```\n\n### FAISS (similarity search)\n\n```python\nfrom langchain_community.vectorstores import FAISS\n\nvectorstore = FAISS.from_documents(docs, OpenAIEmbeddings())\nvectorstore.save_local(\"faiss_index\")\n\n# Load later\nvectorstore = FAISS.load_local(\"faiss_index\", OpenAIEmbeddings())\n```\n\n## Document loaders\n\n```python\n# Web pages\nfrom langchain_community.document_loaders import WebBaseLoader\nloader = WebBaseLoader(\"https:\u002F\u002Fexample.com\")\n\n# PDFs\nfrom langchain_community.document_loaders import PyPDFLoader\nloader = PyPDFLoader(\"paper.pdf\")\n\n# GitHub\nfrom langchain_community.document_loaders import GithubFileLoader\nloader = GithubFileLoader(repo=\"user\u002Frepo\", file_filter=lambda x: x.endswith(\".py\"))\n\n# CSV\nfrom langchain_community.document_loaders import CSVLoader\nloader = CSVLoader(\"data.csv\")\n```\n\n## Text splitters\n\n```python\n# Recursive (recommended for general text)\nfrom langchain.text_splitter import RecursiveCharacterTextSplitter\nsplitter = RecursiveCharacterTextSplitter(\n    chunk_size=1000,\n    chunk_overlap=200,\n    separators=[\"\\n\\n\", \"\\n\", \" \", \"\"]\n)\n\n# Code-aware\nfrom langchain.text_splitter import PythonCodeTextSplitter\nsplitter = PythonCodeTextSplitter(chunk_size=500)\n\n# Semantic (by meaning)\nfrom langchain_experimental.text_splitter import SemanticChunker\nsplitter = SemanticChunker(OpenAIEmbeddings())\n```\n\n## Best practices\n\n1. **Start simple** - Use `create_agent()` for most cases\n2. **Enable streaming** - Better UX for long responses\n3. **Add error handling** - Tools can fail, handle gracefully\n4. **Use LangSmith** - Essential for debugging agents\n5. **Optimize chunk size** - 500-1000 chars for RAG\n6. **Version prompts** - Track changes in production\n7. **Cache embeddings** - Expensive, cache when possible\n8. **Monitor costs** - Track token usage with LangSmith\n\n## Performance benchmarks\n\n| Operation | Latency | Notes |\n|-----------|---------|-------|\n| Simple LLM call | ~1-2s | Depends on provider |\n| Agent with 1 tool | ~3-5s | ReAct reasoning overhead |\n| RAG retrieval | ~0.5-1s | Vector search + LLM |\n| Embedding 1000 docs | ~10-30s | Depends on model |\n\n## LangChain vs LangGraph\n\n| Feature | LangChain | LangGraph |\n|---------|-----------|-----------|\n| **Best for** | Quick agents, RAG | Complex workflows |\n| **Abstraction level** | High | Low |\n| **Code to start** | \u003C10 lines | ~30 lines |\n| **Control** | Simple | Full control |\n| **Stateful workflows** | Limited | Native |\n| **Cyclic graphs** | No | Yes |\n| **Human-in-loop** | Basic | Advanced |\n\n**Use LangGraph when:**\n- Need stateful workflows with cycles\n- Require fine-grained control\n- Building multi-agent systems\n- Production apps with complex logic\n\n## References\n\n- **[Agents Guide](references\u002Fagents.md)** - ReAct, tool calling, streaming\n- **[RAG Guide](references\u002Frag.md)** - Document loaders, retrievers, QA chains\n- **[Integration Guide](references\u002Fintegration.md)** - Vector stores, LangSmith, deployment\n\n## Resources\n\n- **GitHub**: https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Flangchain ⭐ 119,000+\n- **Docs**: https:\u002F\u002Fdocs.langchain.com\n- **API Reference**: https:\u002F\u002Freference.langchain.com\u002Fpython\n- **LangSmith**: https:\u002F\u002Fsmith.langchain.com (observability)\n- **Version**: 0.3+ (stable)\n- **License**: MIT\n\n\n","# LangChain - Build LLM Applications with Agents & RAG\n\nThe most popular framework for building LLM-powered applications.\n\n## When to use LangChain\n\n**Use LangChain when:**\n- Building agents with tool calling and reasoning (ReAct pattern)\n- Implementing RAG (retrieval-augmented generation) pipelines\n- Need to swap LLM providers easily (OpenAI, Anthropic, Google)\n- Creating chatbots with conversation memory\n- Rapid prototyping of LLM applications\n- Production deployments with LangSmith observability\n\n**Metrics**:\n- **119,000+ GitHub stars**\n- **272,000+ repositories** use LangChain\n- **500+ integrations** (models, vector stores, tools)\n- **3,800+ contributors**\n\n**Use alternatives instead**:\n- **LlamaIndex**: RAG-focused, better for document Q&A\n- **LangGraph**: Complex stateful workflows, more control\n- **Haystack**: Production search pipelines\n- **Semantic Kernel**: Microsoft ecosystem\n\n## Quick start\n\n### Installation\n\n```bash\n# Core library (Python 3.10+)\npip install -U langchain\n\n# With OpenAI\npip install langchain-openai\n\n# With Anthropic\npip install langchain-anthropic\n\n# Common extras\npip install langchain-community  # 500+ integrations\npip install langchain-chroma     # Vector store\n```\n\n### Basic LLM usage\n\n```python\nfrom langchain_anthropic import ChatAnthropic\n\n# Initialize model\nllm = ChatAnthropic(model=\"claude-sonnet-4-5-20250929\")\n\n# Simple completion\nresponse = llm.invoke(\"Explain quantum computing in 2 sentences\")\nprint(response.content)\n```\n\n### Create an agent (ReAct pattern)\n\n```python\nfrom langchain.agents import create_agent\nfrom langchain_anthropic import ChatAnthropic\n\n# Define tools\ndef get_weather(city: str) -> str:\n    \"\"\"Get current weather for a city.\"\"\"\n    return f\"It's sunny in {city}, 72°F\"\n\ndef search_web(query: str) -> str:\n    \"\"\"Search the web for information.\"\"\"\n    return f\"Search results for: {query}\"\n\n# Create agent (\u003C10 lines!)\nagent = create_agent(\n    model=ChatAnthropic(model=\"claude-sonnet-4-5-20250929\"),\n    tools=[get_weather, search_web],\n    system_prompt=\"You are a helpful assistant. Use tools when needed.\"\n)\n\n# Run agent\nresult = agent.invoke({\"messages\": [{\"role\": \"user\", \"content\": \"What's the weather in Paris?\"}]})\nprint(result[\"messages\"][-1].content)\n```\n\n## Core concepts\n\n### 1. Models - LLM abstraction\n\n```python\nfrom langchain_openai import ChatOpenAI\nfrom langchain_anthropic import ChatAnthropic\nfrom langchain_google_genai import ChatGoogleGenerativeAI\n\n# Swap providers easily\nllm = ChatOpenAI(model=\"gpt-4o\")\nllm = ChatAnthropic(model=\"claude-sonnet-4-5-20250929\")\nllm = ChatGoogleGenerativeAI(model=\"gemini-2.0-flash-exp\")\n\n# Streaming\nfor chunk in llm.stream(\"Write a poem\"):\n    print(chunk.content, end=\"\", flush=True)\n```\n\n### 2. Chains - Sequential operations\n\n```python\nfrom langchain.chains import LLMChain\nfrom langchain.prompts import PromptTemplate\n\n# Define prompt template\nprompt = PromptTemplate(\n    input_variables=[\"topic\"],\n    template=\"Write a 3-sentence summary about {topic}\"\n)\n\n# Create chain\nchain = LLMChain(llm=llm, prompt=prompt)\n\n# Run chain\nresult = chain.run(topic=\"machine learning\")\n```\n\n### 3. Agents - Tool-using reasoning\n\n**ReAct (Reasoning + Acting) pattern:**\n\n```python\nfrom langchain.agents import create_tool_calling_agent, AgentExecutor\nfrom langchain.tools import Tool\n\n# Define custom tool\ncalculator = Tool(\n    name=\"Calculator\",\n    func=lambda x: eval(x),\n    description=\"Useful for math calculations. Input: valid Python expression.\"\n)\n\n# Create agent with tools\nagent = create_tool_calling_agent(\n    llm=llm,\n    tools=[calculator, search_web],\n    prompt=\"Answer questions using available tools\"\n)\n\n# Create executor\nagent_executor = AgentExecutor(agent=agent, tools=[calculator], verbose=True)\n\n# Run with reasoning\nresult = agent_executor.invoke({\"input\": \"What is 25 * 17 + 142?\"})\n```\n\n### 4. Memory - Conversation history\n\n```python\nfrom langchain.memory import ConversationBufferMemory\nfrom langchain.chains import ConversationChain\n\n# Add memory to track conversation\nmemory = ConversationBufferMemory()\n\nconversation = ConversationChain(\n    llm=llm,\n    memory=memory,\n    verbose=True\n)\n\n# Multi-turn conversation\nconversation.predict(input=\"Hi, I'm Alice\")\nconversation.predict(input=\"What's my name?\")  # Remembers \"Alice\"\n```\n\n## RAG (Retrieval-Augmented Generation)\n\n### Basic RAG pipeline\n\n```python\nfrom langchain_community.document_loaders import WebBaseLoader\nfrom langchain.text_splitter import RecursiveCharacterTextSplitter\nfrom langchain_openai import OpenAIEmbeddings\nfrom langchain_chroma import Chroma\nfrom langchain.chains import RetrievalQA\n\n# 1. Load documents\nloader = WebBaseLoader(\"https:\u002F\u002Fdocs.python.org\u002F3\u002Ftutorial\u002F\")\ndocs = loader.load()\n\n# 2. Split into chunks\ntext_splitter = RecursiveCharacterTextSplitter(\n    chunk_size=1000,\n    chunk_overlap=200\n)\nsplits = text_splitter.split_documents(docs)\n\n# 3. Create embeddings and vector store\nvectorstore = Chroma.from_documents(\n    documents=splits,\n    embedding=OpenAIEmbeddings()\n)\n\n# 4. Create retriever\nretriever = vectorstore.as_retriever(search_kwargs={\"k\": 4})\n\n# 5. Create QA chain\nqa_chain = RetrievalQA.from_chain_type(\n    llm=llm,\n    retriever=retriever,\n    return_source_documents=True\n)\n\n# 6. Query\nresult = qa_chain({\"query\": \"What are Python decorators?\"})\nprint(result[\"result\"])\nprint(f\"Sources: {result['source_documents']}\")\n```\n\n### Conversational RAG with memory\n\n```python\nfrom langchain.chains import ConversationalRetrievalChain\n\n# RAG with conversation memory\nqa = ConversationalRetrievalChain.from_llm(\n    llm=llm,\n    retriever=retriever,\n    memory=ConversationBufferMemory(\n        memory_key=\"chat_history\",\n        return_messages=True\n    )\n)\n\n# Multi-turn RAG\nqa({\"question\": \"What is Python used for?\"})\nqa({\"question\": \"Can you elaborate on web development?\"})  # Remembers context\n```\n\n## Advanced agent patterns\n\n### Structured output\n\n```python\nfrom langchain_core.pydantic_v1 import BaseModel, Field\n\n# Define schema\nclass WeatherReport(BaseModel):\n    city: str = Field(description=\"City name\")\n    temperature: float = Field(description=\"Temperature in Fahrenheit\")\n    condition: str = Field(description=\"Weather condition\")\n\n# Get structured response\nstructured_llm = llm.with_structured_output(WeatherReport)\nresult = structured_llm.invoke(\"What's the weather in SF? It's 65F and sunny\")\nprint(result.city, result.temperature, result.condition)\n```\n\n### Parallel tool execution\n\n```python\nfrom langchain.agents import create_tool_calling_agent\n\n# Agent automatically parallelizes independent tool calls\nagent = create_tool_calling_agent(\n    llm=llm,\n    tools=[get_weather, search_web, calculator]\n)\n\n# This will call get_weather(\"Paris\") and get_weather(\"London\") in parallel\nresult = agent.invoke({\n    \"messages\": [{\"role\": \"user\", \"content\": \"Compare weather in Paris and London\"}]\n})\n```\n\n### Streaming agent execution\n\n```python\n# Stream agent steps\nfor step in agent_executor.stream({\"input\": \"Research AI trends\"}):\n    if \"actions\" in step:\n        print(f\"Tool: {step['actions'][0].tool}\")\n    if \"output\" in step:\n        print(f\"Output: {step['output']}\")\n```\n\n## Common patterns\n\n### Multi-document QA\n\n```python\nfrom langchain.chains.qa_with_sources import load_qa_with_sources_chain\n\n# Load multiple documents\ndocs = [\n    loader.load(\"https:\u002F\u002Fdocs.python.org\"),\n    loader.load(\"https:\u002F\u002Fdocs.numpy.org\")\n]\n\n# QA with source citations\nchain = load_qa_with_sources_chain(llm, chain_type=\"stuff\")\nresult = chain({\"input_documents\": docs, \"question\": \"How to use numpy arrays?\"})\nprint(result[\"output_text\"])  # Includes source citations\n```\n\n### Custom tools with error handling\n\n```python\nfrom langchain.tools import tool\n\n@tool\ndef risky_operation(query: str) -> str:\n    \"\"\"Perform a risky operation that might fail.\"\"\"\n    try:\n        # Your operation here\n        result = perform_operation(query)\n        return f\"Success: {result}\"\n    except Exception as e:\n        return f\"Error: {str(e)}\"\n\n# Agent handles errors gracefully\nagent = create_agent(model=llm, tools=[risky_operation])\n```\n\n### LangSmith observability\n\n```python\nimport os\n\n# Enable tracing\nos.environ[\"LANGCHAIN_TRACING_V2\"] = \"true\"\nos.environ[\"LANGCHAIN_API_KEY\"] = \"your-api-key\"\nos.environ[\"LANGCHAIN_PROJECT\"] = \"my-project\"\n\n# All chains\u002Fagents automatically traced\nagent = create_agent(model=llm, tools=[calculator])\nresult = agent.invoke({\"input\": \"Calculate 123 * 456\"})\n\n# View traces at smith.langchain.com\n```\n\n## Vector stores\n\n### Chroma (local)\n\n```python\nfrom langchain_chroma import Chroma\n\nvectorstore = Chroma.from_documents(\n    documents=docs,\n    embedding=OpenAIEmbeddings(),\n    persist_directory=\".\u002Fchroma_db\"\n)\n```\n\n### Pinecone (cloud)\n\n```python\nfrom langchain_pinecone import PineconeVectorStore\n\nvectorstore = PineconeVectorStore.from_documents(\n    documents=docs,\n    embedding=OpenAIEmbeddings(),\n    index_name=\"my-index\"\n)\n```\n\n### FAISS (similarity search)\n\n```python\nfrom langchain_community.vectorstores import FAISS\n\nvectorstore = FAISS.from_documents(docs, OpenAIEmbeddings())\nvectorstore.save_local(\"faiss_index\")\n\n# Load later\nvectorstore = FAISS.load_local(\"faiss_index\", OpenAIEmbeddings())\n```\n\n## Document loaders\n\n```python\n# Web pages\nfrom langchain_community.document_loaders import WebBaseLoader\nloader = WebBaseLoader(\"https:\u002F\u002Fexample.com\")\n\n# PDFs\nfrom langchain_community.document_loaders import PyPDFLoader\nloader = PyPDFLoader(\"paper.pdf\")\n\n# GitHub\nfrom langchain_community.document_loaders import GithubFileLoader\nloader = GithubFileLoader(repo=\"user\u002Frepo\", file_filter=lambda x: x.endswith(\".py\"))\n\n# CSV\nfrom langchain_community.document_loaders import CSVLoader\nloader = CSVLoader(\"data.csv\")\n```\n\n## Text splitters\n\n```python\n# Recursive (recommended for general text)\nfrom langchain.text_splitter import RecursiveCharacterTextSplitter\nsplitter = RecursiveCharacterTextSplitter(\n    chunk_size=1000,\n    chunk_overlap=200,\n    separators=[\"\\n\\n\", \"\\n\", \" \", \"\"]\n)\n\n# Code-aware\nfrom langchain.text_splitter import PythonCodeTextSplitter\nsplitter = PythonCodeTextSplitter(chunk_size=500)\n\n# Semantic (by meaning)\nfrom langchain_experimental.text_splitter import SemanticChunker\nsplitter = SemanticChunker(OpenAIEmbeddings())\n```\n\n## Best practices\n\n1. **Start simple** - Use `create_agent()` for most cases\n2. **Enable streaming** - Better UX for long responses\n3. **Add error handling** - Tools can fail, handle gracefully\n4. **Use LangSmith** - Essential for debugging agents\n5. **Optimize chunk size** - 500-1000 chars for RAG\n6. **Version prompts** - Track changes in production\n7. **Cache embeddings** - Expensive, cache when possible\n8. **Monitor costs** - Track token usage with LangSmith\n\n## Performance benchmarks\n\n| Operation | Latency | Notes |\n|-----------|---------|-------|\n| Simple LLM call | ~1-2s | Depends on provider |\n| Agent with 1 tool | ~3-5s | ReAct reasoning overhead |\n| RAG retrieval | ~0.5-1s | Vector search + LLM |\n| Embedding 1000 docs | ~10-30s | Depends on model |\n\n## LangChain vs LangGraph\n\n| Feature | LangChain | LangGraph |\n|---------|-----------|-----------|\n| **Best for** | Quick agents, RAG | Complex workflows |\n| **Abstraction level** | High | Low |\n| **Code to start** | \u003C10 lines | ~30 lines |\n| **Control** | Simple | Full control |\n| **Stateful workflows** | Limited | Native |\n| **Cyclic graphs** | No | Yes |\n| **Human-in-loop** | Basic | Advanced |\n\n**Use LangGraph when:**\n- Need stateful workflows with cycles\n- Require fine-grained control\n- Building multi-agent systems\n- Production apps with complex logic\n\n## References\n\n- **[Agents Guide](references\u002Fagents.md)** - ReAct, tool calling, streaming\n- **[RAG Guide](references\u002Frag.md)** - Document loaders, retrievers, QA chains\n- **[Integration Guide](references\u002Fintegration.md)** - Vector stores, LangSmith, deployment\n\n## Resources\n\n- **GitHub**: https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Flangchain ⭐ 119,000+\n- **Docs**: https:\u002F\u002Fdocs.langchain.com\n- **API Reference**: https:\u002F\u002Freference.langchain.com\u002Fpython\n- **LangSmith**: https:\u002F\u002Fsmith.langchain.com (observability)\n- **Version**: 0.3+ (stable)\n- **License**: MIT\n\n\n",{"name":5,"tags":24,"author":35,"license":15,"version":36,"description":7,"dependencies":37},[25,26,27,28,29,30,31,32,33,34],"Agents","LangChain","RAG","Tool Calling","ReAct","Memory Management","Vector Stores","LLM Applications","Chatbots","Production","Orchestra Research","1.0.0",[5,38,39,40],"langchain-core","langchain-openai","langchain-anthropic","master","c247302c836de6438d746b45670990eb71691166","skills_collected\u002FOrchestra-Research--AI-research-SKILLs--14-agents__langchain",1,"https:\u002F\u002Fgithub.com\u002Fqhjqhj00\u002Fresearch-skills-pool","https:\u002F\u002Fgithub.com\u002Fqhjqhj00","chien.io","2026-05-11 15:07:59",{"source":8,"skillName":5,"commands":50,"prompt":60,"zipAvailable":61},[51,54,57],{"tool":52,"command":53},"npx","npx skills add qhjqhj00\u002Fresearch-skills-pool --skill langchain",{"tool":55,"command":56},"bunx","bunx skills add qhjqhj00\u002Fresearch-skills-pool --skill langchain",{"tool":58,"command":59},"pnpm","pnpm dlx skills add qhjqhj00\u002Fresearch-skills-pool --skill langchain","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fqhjqhj00\u002Fresearch-skills-pool\u002Fblob\u002Fmaster\u002Fskills_collected\u002FOrchestra-Research--AI-research-SKILLs--14-agents__langchain\u002FSKILL.md",true,[63,69,73],{"path":64,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":67,"sourceHtmlUrl":68},"references\u002Fagents.md","REFERENCE","参考文档",12661,"https:\u002F\u002Fgithub.com\u002Fqhjqhj00\u002Fresearch-skills-pool\u002Fblob\u002Fmaster\u002Fskills_collected\u002FOrchestra-Research--AI-research-SKILLs--14-agents__langchain\u002Freferences\u002Fagents.md",{"path":70,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":71,"sourceHtmlUrl":72},"references\u002Fintegration.md",11832,"https:\u002F\u002Fgithub.com\u002Fqhjqhj00\u002Fresearch-skills-pool\u002Fblob\u002Fmaster\u002Fskills_collected\u002FOrchestra-Research--AI-research-SKILLs--14-agents__langchain\u002Freferences\u002Fintegration.md",{"path":74,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":75,"sourceHtmlUrl":76},"references\u002Frag.md",14490,"https:\u002F\u002Fgithub.com\u002Fqhjqhj00\u002Fresearch-skills-pool\u002Fblob\u002Fmaster\u002Fskills_collected\u002FOrchestra-Research--AI-research-SKILLs--14-agents__langchain\u002Freferences\u002Frag.md",[78,85,92,99,106,113],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M73JJB6EQPFPPVQK2Y9N67Q0","transformer-lens-interpretability","Provides guidance for mechanistic interpretability research using TransformerLens to inspect and manipulate transformer internals via HookPoints and activation caching. Use when reverse-engineering model algorithms, studying attention patterns, or performing activation patching experiments.","https:\u002F\u002Fgithub.com\u002Fqhjqhj00\u002Fresearch-skills-pool\u002Fblob\u002Fmaster\u002Ftop100-runs\u002F130-transformer-lens\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M73JHTANRRWEE9HP98TPEHAY","wiki-vitepress","Packages generated wiki Markdown into a VitePress static site with dark theme, dark-mode Mermaid diagrams with click-to-zoom, and production build output. Use when the user wants to create a browsable website from generated wiki pages.","https:\u002F\u002Fgithub.com\u002Fqhjqhj00\u002Fresearch-skills-pool\u002Fblob\u002Fmaster\u002Ftop100-runs\u002F126-wiki-vitepress\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":19},"01M73JHJBMVFW46F1Y8K3SBF43","phoenix-observability","Open-source AI observability platform for LLM tracing, evaluation, and monitoring. Use when debugging LLM applications with detailed traces, running evaluations on datasets, or monitoring production AI systems with real-time insights.","https:\u002F\u002Fgithub.com\u002Fqhjqhj00\u002Fresearch-skills-pool\u002Fblob\u002Fmaster\u002Ftop100-runs\u002F124-phoenix\u002FSKILL.md",[],[],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":19},"01M73JHFPA3A2806PMP42ZN86Q","frontend-ui-dark-ts","Build dark-themed React applications using Tailwind CSS with custom theming, glassmorphism effects, and Framer Motion animations. Use when creating dashboards, admin panels, or data-rich interfaces with a refined dark aesthetic.","https:\u002F\u002Fgithub.com\u002Fqhjqhj00\u002Fresearch-skills-pool\u002Fblob\u002Fmaster\u002Ftop100-runs\u002F123-frontend-ui-dark-ts\u002FSKILL.md",[],[],{"skillNo":107,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":19},"01M73JFVBVK57NRJS49TT2VDCT","tensorboard","Visualize training metrics, debug models with histograms, compare experiments, visualize model graphs, and profile performance with TensorBoard - Google's ML visualization toolkit","https:\u002F\u002Fgithub.com\u002Fqhjqhj00\u002Fresearch-skills-pool\u002Fblob\u002Fmaster\u002Ftop100-runs\u002F113-tensorboard\u002FSKILL.md",[],[],{"skillNo":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":117,"licenseFileUrl":6,"sourceHtmlUrl":118,"categories":119,"keywords":120,"publishedAt":19},"01M73JFF6PK6ZCN41C89J7HS2B","markdown-mermaid-writing","Comprehensive markdown and Mermaid diagram writing skill. Use when creating any scientific document, report, analysis, or visualization. Establishes text-based diagrams as the default documentation standard with full style guides (markdown + mermaid), 24 diagram type references, and 9 document templates.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fqhjqhj00\u002Fresearch-skills-pool\u002Fblob\u002Fmaster\u002Ftop100-runs\u002F110-markdown-mermaid-writing\u002FSKILL.md",[],[]]