langchain-ai avatar

Langchain Fundamentals

If you're building LangChain agents, this cuts through the API confusion and focuses on create_agent(), which is what actually works in production. It covers the middleware patterns you'll need for human-in-the-loop workflows and error handling, plus proper tool definition with the @tool decorator. The examples show real patterns like state persistence with MemorySaver and structured output validation. Most LangChain tutorials still reference deprecated agent classes, so this keeps you on the current approach that won't break in six months.

skills.sh installs
18.2K
GitHub stars
1.3K
last updated
Aug 21, 2026

Install

$ npx -y skills add langchain-ai/langchain-skills --skill langchain-fundamentals --agent claude-code

Installs into .claude/skills of the current project.

Files

Build production agents using `create_agent()`, middleware patterns, and the `@tool` decorator / `tool()` function. When creating LangChain agents, you MUST use create_agent(), with middleware for custom flows. All other alternatives are outdated.

<create_agent>

Creating Agents with create_agent

create_agent() is the recommended way to build agents. It handles the agent loop, tool execution, and state management.

Agent Configuration Options

ParameterPurposeExample
modelLLM to use"anthropic:claude-sonnet-4-5" or model instance
toolsList of tools[search, calculator]
system_prompt / systemPromptAgent instructions"You are a helpful assistant"
checkpointerState persistenceMemorySaver()
middlewareProcessing hooks[HumanInTheLoopMiddleware] (Python) / [humanInTheLoopMiddleware({...})] (TypeScript)
</create_agent>
from langchain.agents import create_agent
from langchain_core.tools import tool

@tool
def get_weather(location: str) -> str:
    """Get current weather for a location.

Sponsors

Details

Repository
github.com/langchain-ai/langchain-skills
Categories
Backend & APIs, AI & Agent Building, Debugging

More from langchain-ai/langchain-skills

All 15
1wshobson avataropenapi-spec-generationwshobson/agentsGenerate and maintain OpenAPI 3.1 specifications from code, design-first specs, and validation patterns. Use when creating API documentation, generating SDKs, o17Kskills.sh installs
2gargantuax avatargpt-image-2gargantuax/openskillsFull OpenAI-compatible GPT Image 2 coverage across images/generations, images/edits, and responses with the image_generation tool. Use when the one-shot image h16.8Kskills.sh installs
3okx avatarokx-agent-payments-protocolokx/onchainos-skillsUse when an agent hits HTTP 402 / payment-required, or the user mentions x402, x402Version, X-PAYMENT, PAYMENT-REQUIRED, PAYMENT-SIGNATURE, WWW-Authenticate: Pa15.9Kskills.sh installs
4clerk avatarclerk-swiftclerk/skillsImplement Clerk authentication for native Swift and iOS apps using ClerkKit and ClerkKitUI source-guided patterns. Use for prebuilt AuthView or custom native fl15Kskills.sh installs
5clerk avatarclerk-expoclerk/skillsAdd Clerk authentication to Expo and React Native apps using @clerk/expo. Use for Expo setup, prebuilt native components (AuthView, UserButton), custom sign-in/14.8Kskills.sh installs
6base44 avatarbase44-sdkbase44/skillsThe base44 SDK is the library to communicate with base44 services. In projects, you use it to communicate with remote resources (entities, backend functions, ai13.3Kskills.sh installs