Tooluck logoTooluck
SKILL.md

langchain-fundamentals

Agent skill fromlangchain-ai/langchain-skills

Create LangChain agents with create_agent, define tools, and use middleware for human-in-the-loop and error handling.

How to install langchain-fundamentals

install langchain-fundamentals
# install the langchain-skills pack with the skills CLI
npx skills add langchain-ai/langchain-skills

# or add only this skill to Claude Code: copy the folder

config/skills/langchain-fundamentals/

# into

~/.claude/skills/langchain-fundamentals/ (all projects)

.claude/skills/langchain-fundamentals/ (one project)

config/skills/langchain-fundamentals/SKILL.md

MITFull file
1<oneliner>
2Build 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.
3</oneliner>
4
5<create_agent>
6## Creating Agents with create_agent
7
8`create_agent()` is the recommended way to build agents. It handles the agent loop, tool execution, and state management.
9
10### Agent Configuration Options
11
12| Parameter | Purpose | Example |
13|-----------|---------|---------|
14| `model` | LLM to use | `"anthropic:claude-sonnet-4-5"` or model instance |
15| `tools` | List of tools | `[search, calculator]` |
16| `system_prompt` / `systemPrompt` | Agent instructions | `"You are a helpful assistant"` |
17| `checkpointer` | State persistence | `MemorySaver()` |
18| `middleware` | Processing hooks | `[HumanInTheLoopMiddleware]` (Python) / `[humanInTheLoopMiddleware({...})]` (TypeScript) |
19</create_agent>
20
21<ex-basic-agent>
22<python>
23
24```python
25from langchain.agents import create_agent
26from langchain_core.tools import tool
27
28@tool
29def get_weather(location: str) -> str:
30 """Get current weather for a location.
31
32 Args:
33 location: City name
34 """
35 return f"Weather in {location}: Sunny, 72F"
36
37agent = create_agent(
38 model="anthropic:claude-sonnet-4-5",
39 tools=[get_weather],
40 system_prompt="You are a helpful assistant."
41)
42
43result = agent.invoke({
44…

Excerpt shown under the repository's MIT license.

More skills in langchain-skills

Keep exploring

Similar skill repositories

thedotmack /

claude-mem
116k

Persistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More

CCCXGHGM+135 skills

Newsletter

Join the Community

Subscribe to our newsletter for the latest news and updates