$npx -y skills add krzysztofsurdy/code-virtuoso --skill langchain-componentsComprehensive reference for the LangChain ecosystem including LangChain, LangGraph, and Deep Agents for Python 3.10+. Use when the user asks to build AI agents, implement RAG pipelines, configure chat models, create tool-calling agents, set up retrieval chains, manage conversatio
| 1 | # LangChain Components |
| 2 | |
| 3 | Complete reference for the LangChain ecosystem — models, agents, tools, retrieval, memory, middleware, streaming, multi-agent orchestration, LangGraph workflows, Deep Agents, and provider integrations for Python 3.10+. |
| 4 | |
| 5 | ## Component Index |
| 6 | |
| 7 | ### Models & Output |
| 8 | - **Models** — Chat models, tool calling, multimodal inputs, caching, rate limiting, custom models [reference](references/models.md) |
| 9 | - **Messages** — Message types (Human, AI, System, Tool), message operations, serialization, OpenAI format conversion [reference](references/messages.md) |
| 10 | |
| 11 | ### Agents |
| 12 | - **Agents** — create_agent, tools, structured output, guardrails, human-in-the-loop, context engineering [reference](references/agents.md) |
| 13 | - **Multi-Agent** — Subagents, handoffs, skills, router, custom workflows, pattern selection [reference](references/multi-agent.md) |
| 14 | |
| 15 | ### Tools & MCP |
| 16 | - **Tools** — Tool creation (@tool decorator, ToolNode), InjectedState, MCP integration, error handling [reference](references/tools.md) |
| 17 | |
| 18 | ### Retrieval & RAG |
| 19 | - **Retrieval** — Document loaders, text splitters, embeddings, vector stores, agentic RAG, semantic search [reference](references/retrieval.md) |
| 20 | |
| 21 | ### Memory |
| 22 | - **Memory** — Short-term (checkpointers, message trimming, summarization), long-term (store abstraction, namespaces) [reference](references/memory.md) |
| 23 | |
| 24 | ### Middleware & Streaming |
| 25 | - **Middleware** — 16 built-in middleware, custom middleware (decorator, class, wrap-style), execution order [reference](references/middleware.md) |
| 26 | - **Streaming** — Stream modes (updates, messages, custom), token streaming, useStream React hook [reference](references/streaming.md) |
| 27 | |
| 28 | ### Runtime & Architecture |
| 29 | - **Runtime** — Dependency injection, context schemas, ToolRuntime, component architecture (5 layers) [reference](references/runtime.md) |
| 30 | |
| 31 | ### Testing & Deployment |
| 32 | - **Testing** — Unit testing (GenericFakeChatModel), integration testing (AgentEvals), LangSmith observability [reference](references/testing.md) |
| 33 | |
| 34 | ### LangGraph |
| 35 | - **LangGraph Core** — Graph API, Functional API, workflows vs agents, state management, quickstart [reference](references/langgraph-core.md) |
| 36 | - **LangGraph State** — Memory, persistence, durable execution, interrupts, checkpointers [reference](references/langgraph-state.md) |
| 37 | - **LangGraph Advanced** — Subgraphs, time-travel, streaming, Graph API usage, Functional API usage [reference](references/langgraph-advanced.md) |
| 38 | |
| 39 | ### Deep Agents |
| 40 | - **Deep Agents** — Harness framework, models, subagents, skills, sandboxes, human-in-the-loop, long-term memory [reference](references/deep-agents.md) |
| 41 | |
| 42 | ### Integrations |
| 43 | - **Integrations** — Chat models, document loaders, retrievers, embeddings, vector stores, tools, stores, splitters [reference](references/integrations.md) |
| 44 | - **Providers** — OpenAI, Anthropic, Google, AWS, Ollama setup and configuration [reference](references/providers.md) |
| 45 | |
| 46 | ## Quick Patterns |
| 47 | |
| 48 | ### Create an Agent with Tools |
| 49 | |
| 50 | ```python |
| 51 | from langchain.chat_models import init_chat_model |
| 52 | from langgraph.prebuilt import create_agent |
| 53 | |
| 54 | model = init_chat_model("anthropic:claude-sonnet-4-20250514") |
| 55 | |
| 56 | def get_weather(city: str) -> str: |
| 57 | """Get weather for a city.""" |
| 58 | return f"Sunny, 72F in {city}" |
| 59 | |
| 60 | agent = create_agent(model, [get_weather]) |
| 61 | response = agent.invoke( |
| 62 | {"messages": [{"role": "user", "content": "What's the weather in SF?"}]} |
| 63 | ) |
| 64 | ``` |
| 65 | |
| 66 | ### Structured Output |
| 67 | |
| 68 | ```python |
| 69 | from pydantic import BaseModel |
| 70 | |
| 71 | class SearchQuery(BaseModel): |
| 72 | query: str |
| 73 | year: int |
| 74 | |
| 75 | structured_model = model.with_structured_output(SearchQuery) |
| 76 | result = structured_model.invoke("Who won the World Cup in 2022?") |
| 77 | ``` |
| 78 | |
| 79 | ### RAG with Retrieval |
| 80 | |
| 81 | ```python |
| 82 | from langchain_community.document_loaders import WebBaseLoader |
| 83 | from langchain_text_splitters import RecursiveCharacterTextSplitter |
| 84 | from langchain_openai import OpenAIEmbeddings |
| 85 | from langchain_core.vectorstores import InMemoryVectorStore |
| 86 | |
| 87 | docs = WebBaseLoader("https://example.com").load() |
| 88 | chunks = RecursiveCharacterTextSplitter(chunk_size=1000).split_documents(docs) |
| 89 | vector_store = InMemoryVectorStore.from_documents(chunks, OpenAIEmbeddings()) |
| 90 | retriever_tool = vector_store.as_retriever() |
| 91 | ``` |
| 92 | |
| 93 | ### Multi-Agent Handoffs |
| 94 | |
| 95 | ```python |
| 96 | from langgraph.prebuilt import create_agent |
| 97 | |
| 98 | billing_agent = create_agent(model, [lookup_billing], name="billing") |
| 99 | tech_agent = create_agent(model, [check_status], name="tech_support") |
| 100 | supervis |