langchain-fundamentals

Installation
Summary

Build production LangChain agents with create_agent(), tools, and middleware patterns.

  • Use create_agent() with model, tools list, and system prompt; configure state persistence with checkpointer and thread_id for conversation memory across invocations
  • Define tools via @tool decorator (Python) or tool() function (TypeScript) with clear descriptions so agents know when to call them
  • Add middleware like HumanInTheLoopMiddleware for approval workflows, custom error handling, and human-in-the-loop control over agent decisions
  • Set recursion_limit in invoke config to prevent infinite loops, and access results via result["messages"][-1].content rather than direct content access
SKILL.md

<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

Parameter Purpose Example
model LLM to use "anthropic:claude-sonnet-4-5" or model instance
tools List of tools [search, calculator]
system_prompt / systemPrompt Agent instructions "You are a helpful assistant"
checkpointer State persistence MemorySaver()
middleware Processing hooks [HumanInTheLoopMiddleware] (Python) / [humanInTheLoopMiddleware({...})] (TypeScript)
</create_agent>
Related skills
Installs
6.7K
GitHub Stars
678
First Seen
Feb 21, 2026