[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6QEZTRR6GYPRM8P0TYTJFMP":3,"skill-same:01M6QEZTRR6GYPRM8P0TYTJFMP":101},{"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":23,"publishedAt":43,"linkOnly":44,"markdownContent":45,"markdownBody":46,"frontMatter":47,"refName":54,"commitSha":55,"skillDirectory":56,"forksCount":14,"repositoryHtmlUrl":57,"repositoryHomepageUrl":58,"ownerHtmlUrl":59,"ownerBlogUrl":60,"ownerDescription":61,"updatedAt":62,"install":63,"resources":76},"01M6QEZTRR6GYPRM8P0TYTJFMP","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.","Tashima-Tarsh\u002FDisha6.6","Tashima-Tarsh","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F269906498?v=4","01M6PBH98X03XERH0HFT4PFB1P","NITISH KUMAR","01M6PBH9DA0M6KM3Z12P848F0K",0,"MIT","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fkal-langchain\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000009","前端开发","SCENARIO","使用场景",[5,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42],"management","for","LLM Applications","store","chatbots","systems","calling","memory management","deployments","use","google","question","vector stores","tool","applications","vector","rag","react","memory","2026-11-10 10:12:30",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.\nlicense: MIT\nmetadata:\n  version: 1.0.0\n  category: llm-applications\n  maintainer: Kalaris Labs\n  tags: Agents, LangChain, RAG, Tool Calling, ReAct, Memory Management, Vector Stores, LLM Applications, Chatbots, Production\n  dependencies: 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- **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\nfrom scripts.safe_arithmetic import calculate\n\n# Define custom tool\ncalculator = Tool(\n    name=\"Calculator\",\n    func=lambda x: str(calculate(x)),\n    description=\"Useful for arithmetic with numbers and +, -, *, \u002F.\"\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\nDetails, code examples and parameter tables: [references\u002Frag-retrieval-augmented-generation.md](references\u002Frag-retrieval-augmented-generation.md). Read it when this step applies.\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## Agent operating procedure\n\n1. **Check the environment.** Confirm the framework version, model provider, API keys and rate limits.\n2. **Pin down the inputs.** Confirm formats, identifiers and parameters from the data or the user. Ask rather than guess any value that changes the result.\n3. **Run a small version first.** Test a single call or chain with a known input and inspect raw outputs.\n4. **Execute the full task** using the instructions and references above.\n5. **Validate the result.** Evaluate on a small labeled set; check structured outputs against their schema; log prompts and responses.\n6. **Report.** State what was run (versions, commands, parameters), what was checked, and what is still uncertain.\n\n| If this happens | Do this |\n|---|---|\n| Outputs do not match the expected schema | Add validation and retries, tighten the schema, or simplify the prompt. |\n| A function, flag or endpoint in these instructions is missing in the installed version | Check the installed version's own documentation (`help()`, `--help`, official docs), adapt, and tell the user. Never invent an API. |\n| A required input, identifier or parameter is ambiguous | Ask the user, or state the assumption explicitly before running. |\n\n**Integrity rules**\n\n- Never fabricate results, parameters, identifiers, citations or statistics. If something cannot be run or verified, say so plainly.\n- Never send private or sensitive data to external APIs without the user's consent.\n- Treat version-specific details here as possibly outdated: confirm them against the official documentation for the installed version.\n- Ask before actions that cost money, consume shared GPUs or cloud quota, touch personal or patient data, or cannot be undone.\n\n## Related skills\n\n- `llamaindex`: Data framework for building LLM applications with RAG.\n- `autogpt-agents`: Autonomous AI agent platform for building and deploying continuous agents.\n- `chroma`: Open-source embedding database for AI applications.\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- **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\nfrom scripts.safe_arithmetic import calculate\n\n# Define custom tool\ncalculator = Tool(\n    name=\"Calculator\",\n    func=lambda x: str(calculate(x)),\n    description=\"Useful for arithmetic with numbers and +, -, *, \u002F.\"\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\nDetails, code examples and parameter tables: [references\u002Frag-retrieval-augmented-generation.md](references\u002Frag-retrieval-augmented-generation.md). Read it when this step applies.\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## Agent operating procedure\n\n1. **Check the environment.** Confirm the framework version, model provider, API keys and rate limits.\n2. **Pin down the inputs.** Confirm formats, identifiers and parameters from the data or the user. Ask rather than guess any value that changes the result.\n3. **Run a small version first.** Test a single call or chain with a known input and inspect raw outputs.\n4. **Execute the full task** using the instructions and references above.\n5. **Validate the result.** Evaluate on a small labeled set; check structured outputs against their schema; log prompts and responses.\n6. **Report.** State what was run (versions, commands, parameters), what was checked, and what is still uncertain.\n\n| If this happens | Do this |\n|---|---|\n| Outputs do not match the expected schema | Add validation and retries, tighten the schema, or simplify the prompt. |\n| A function, flag or endpoint in these instructions is missing in the installed version | Check the installed version's own documentation (`help()`, `--help`, official docs), adapt, and tell the user. Never invent an API. |\n| A required input, identifier or parameter is ambiguous | Ask the user, or state the assumption explicitly before running. |\n\n**Integrity rules**\n\n- Never fabricate results, parameters, identifiers, citations or statistics. If something cannot be run or verified, say so plainly.\n- Never send private or sensitive data to external APIs without the user's consent.\n- Treat version-specific details here as possibly outdated: confirm them against the official documentation for the installed version.\n- Ask before actions that cost money, consume shared GPUs or cloud quota, touch personal or patient data, or cannot be undone.\n\n## Related skills\n\n- `llamaindex`: Data framework for building LLM applications with RAG.\n- `autogpt-agents`: Autonomous AI agent platform for building and deploying continuous agents.\n- `chroma`: Open-source embedding database for AI applications.\n",{"name":5,"license":15,"metadata":48,"description":7},{"tags":49,"version":50,"category":51,"maintainer":52,"dependencies":53},"Agents, LangChain, RAG, Tool Calling, ReAct, Memory Management, Vector Stores, LLM Applications, Chatbots, Production","1.0.0","llm-applications","Kalaris Labs","langchain, langchain-core, langchain-openai, langchain-anthropic","main","0da4485785ee599388900be50db1635489d53056",".agents\u002Fskills\u002Fkal-langchain","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6","https:\u002F\u002Fdisha6.6.thenitishkr.in\u002F","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh","www.thenitishkr","thenitishkr | AI • Cyber-security • Research\r\n","2026-11-08 03:33:25",{"source":8,"skillName":5,"commands":64,"prompt":74,"zipAvailable":75},[65,68,71],{"tool":66,"command":67},"npx","npx skills add Tashima-Tarsh\u002FDisha6.6 --skill langchain",{"tool":69,"command":70},"bunx","bunx skills add Tashima-Tarsh\u002FDisha6.6 --skill langchain",{"tool":72,"command":73},"pnpm","pnpm dlx skills add Tashima-Tarsh\u002FDisha6.6 --skill langchain","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fkal-langchain\u002FSKILL.md",true,[77,83,87,91,95],{"path":78,"resourceType":79,"resourceTypeDesc":80,"sizeBytes":81,"sourceHtmlUrl":82},"references\u002Fagents.md","REFERENCE","参考文档",12712,"https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fkal-langchain\u002Freferences\u002Fagents.md",{"path":84,"resourceType":79,"resourceTypeDesc":80,"sizeBytes":85,"sourceHtmlUrl":86},"references\u002Fintegration.md",11832,"https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fkal-langchain\u002Freferences\u002Fintegration.md",{"path":88,"resourceType":79,"resourceTypeDesc":80,"sizeBytes":89,"sourceHtmlUrl":90},"references\u002Frag-retrieval-augmented-generation.md",1569,"https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fkal-langchain\u002Freferences\u002Frag-retrieval-augmented-generation.md",{"path":92,"resourceType":79,"resourceTypeDesc":80,"sizeBytes":93,"sourceHtmlUrl":94},"references\u002Frag.md",14490,"https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fkal-langchain\u002Freferences\u002Frag.md",{"path":96,"resourceType":97,"resourceTypeDesc":98,"sizeBytes":99,"sourceHtmlUrl":100},"scripts\u002Fsafe_arithmetic.py","SCRIPT","脚本",1295,"https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fkal-langchain\u002Fscripts\u002Fsafe_arithmetic.py",[102,131,155,182,207,231],{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":111,"publishedAt":43},"01M6QRD07D4TGNDK6VJ4EHF8BV","youtube-full","Use when the user needs YouTube transcripts, video search, channel browsing, playlist extraction, or content monitoring. Trigger phrases: 'get the transcript for', 'search YouTube for', 'what are the latest videos on', 'list this playlist', 'monitor this channel', or any request involving a YouTube URL, video ID, or @handle. Do NOT use for downloading video or audio files, YouTube engagement data (likes, comments), or private\u002Fage-restricted videos.","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fyoutube-full\u002FSKILL.md",[108],{"categoryNo":109,"categoryName":110,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000016","图像与多媒体",[112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,25,128,129,130],"youtube full","youtube","full","transcript","search","monitoring","data","Video","Audio","list","files","do","get","age","trigger","URL","browsing","request","youtube transcripts",{"skillNo":132,"name":133,"nameZh":6,"description":134,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":135,"categories":136,"keywords":137,"publishedAt":43},"01M6QRCJ3112VYPA97YG7KGMC2","x-twitter-growth","X\u002FTwitter growth engine for building audience, crafting viral content, and analyzing engagement. Use when the user wants to grow on X\u002FTwitter, write tweets or threads, analyze their X profile, research competitors on X, plan a posting strategy, or optimize engagement. Complements social-content (generic multi-platform) with X-specific depth: algorithm mechanics, thread engineering, reply strategy, profile optimization, and competitive intelligence via web search.","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fx-twitter-growth\u002FSKILL.md",[],[138,139,140,141,116,142,143,144,145,146,147,148,149,150,33,151,152,153,154,25],"twitter","x twitter growth","growth","research","content","engineering","plan","web search","competitors","analyze","engine","write","strategy","platform","grow","posting","competitive",{"skillNo":156,"name":157,"nameZh":6,"description":158,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":159,"categories":160,"keywords":164,"publishedAt":43},"01M6QRBN3EHQNJY42RERP7A149","write-a-skill","Create new agent skills with proper structure, progressive disclosure, and bundled resources. Use when user wants to create, write, build, or author a new skill.","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fwrite-a-skill\u002FSKILL.md",[161],{"categoryNo":162,"categoryName":163,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发",[165,149,166,167,168,169,170,171,33,172,173,54,174,175,176,177,178,179,180,181],"write a skill","github","create","https","productivity","matt pocock","direct","example","build","new skill","structure","new agent","resources","with","tree","progressive disclosure","author",{"skillNo":183,"name":184,"nameZh":6,"description":185,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":186,"categories":187,"keywords":188,"publishedAt":43},"01M6QRB6G8P33PNGAF9Y69EJ9T","wrap-up","Close out a launched Claude Managed Agent — recap every primitive the founder now owns, regenerate the single-file overview page, and suggest the next 1-2 upgrades. Use when the user says \"wrap up\", \"close this out\", \"what do I own now\", \"give me the summary\", \"recap the agent\", or when the orchestrator routes phase=wrap-up. primitives_inventory.py tables everything owned (agent, environment, session, memory, outcome, deployment); overview_page.py regenerates a self-contained .\u002Fmy-agent\u002Fagent-overview.html; upgrade_suggester.py ranks the next moves from recorded deferrals plus standing hardening steps. Companion to run-without-you; the last stop before phase=done.","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fwrap-up\u002FSKILL.md",[],[189,190,191,192,193,194,195,196,197,33,198,123,199,200,201,202,203,204,205,206],"wrap up","up","wrap","gemini","deployment","run","file","hardening","closeout","stop","upgrade","founder","close","companion","you","tables","directions","phase",{"skillNo":208,"name":209,"nameZh":6,"description":210,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":211,"categories":212,"keywords":214,"publishedAt":43},"01M6QRA5AYC1RBFZ39GTWGS3N8","workflow-builder","Design and write deterministic multi-agent workflow scripts (.js files in .claude\u002Fworkflows\u002F) for Claude Code's Workflow tool. Use when a user wants to build, create, author, scaffold, or run a custom Claude Code workflow, orchestrate sub-agents (fan-out, pipeline, loop, judge-panel), or automate a repeatable multi-step task across fresh-context agents.","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fworkflow-builder\u002FSKILL.md",[213],{"categoryNo":162,"categoryName":163,"taxonomyType":21,"taxonomyTypeDesc":22},[215,216,217,218,219,167,194,220,221,222,223,224,149,225,122,226,227,228,229,230],"workflow","workflow builder","builder","design","workflows","code","orchestrate","pipeline","loop","multi-agent","context","across","fresh","scripts","judge","claude code workflow",{"skillNo":232,"name":233,"nameZh":6,"description":234,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":235,"categories":236,"keywords":237,"publishedAt":43},"01M6QR7QMCZESKQA0ERW1E657M","weekly-review","Use when someone wants to run a weekly review, close open loops, audit stalled projects and commitments, get their system back to trusted, restart a lapsed review habit, or says \"\u002Fcs:weekly-review\". Walks David Allen's three-phase loop — GET CLEAR, GET CURRENT, GET CREATIVE — with deterministic scripts that inventory open loops, gate the checklist with named gaps, and score commitment health 0-100.","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fweekly-review\u002FSKILL.md",[],[238,239,240,241,242,243,244,245,246,223,247,248,249,250,251,252,124,253,254,206],"review","weekly review","weekly","deterministic scripts","reflect","feeds","inventory","open","team","projects","project-management","scanner","conversation","back","project","sprint","cadence"]