langchain-fundamentals

Build LangChain agents with create_agent, tools, and middleware.

Updated May 29, 2026
One-click install
npx skills add https://github.com/patorn/langgraph-template --skill langchain-fundamentals-patorn
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: langchain-fundamentals
Source: https://github.com/patorn/langgraph-template/tree/main/.agents/skills/langchain-fundamentals
Command: npx skills add https://github.com/patorn/langgraph-template --skill langchain-fundamentals-patorn

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

LangChain agent development can be complex and repetitive; this Skill provides a guided approach to building production-ready agents using create_agent, with tools, middleware, and memory patterns.

Core Features & Use Cases

  • Define agents with create_agent() to manage the agent loop, prompts, and state.
  • Define tools with @tool (Python) or tool() (TypeScript) and attach them to agents.
  • Integrate middleware such as HumanInTheLoopMiddleware to control flows and handle errors, with optional persistence via MemorySaver.
  • See Python and TypeScript examples to illustrate common workflows and quick starts.

Quick Start

Create a simple agent with create_agent, wire a basic tool, and invoke a test message.

Frequently Asked Questions about langchain-fundamentals

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a LangChain agent with custom tools?

To create a LangChain agent with custom tools, use the create_agent() function to manage the agent loop and state, then define tools using the @tool decorator in Python or tool() in TypeScript and attach them to the agent configuration.

How does middleware work in LangChain agents?

Middleware in LangChain agents works by integrating specialized components like HumanInTheLoopMiddleware to control execution flows, handle errors, and manage optional persistence via MemorySaver during the agent loop.

Can I use create_agent with both Python and TypeScript?

Yes, you can use create_agent with both Python and TypeScript. The approach provides specific examples for both languages to illustrate common workflows, tool definitions, and quick starts for your development environment.

What is the best way to add memory persistence to a LangChain agent?

The best way to add memory persistence to a LangChain agent is by integrating middleware like HumanInTheLoopMiddleware and configuring optional persistence using MemorySaver to retain state across interactions.

How do I configure prompts and checks for LangChain agent orchestration?

You configure prompts and checks for LangChain agent orchestration by defining your requirements within the create_agent() function, which manages the agent loop, configurable prompts, and state validation.

Why use middleware for human-in-the-loop control in LangChain?

You use middleware for human-in-the-loop control in LangChain to actively manage agent execution flows, intercept errors, and apply necessary checks before proceeding, ensuring safe and controlled agent orchestration.