langchain-fundamentals

仓库创建 2026年1月22日最近提交 7 小时前SkillHot 收录 1 小时前
▸ 精选理由

把 create_agent 与中间件做为标准化构建流程。

这个 Skill 做什么

指导使用 create_agent、工具与中间件构建生产级 LangChain agent。

用 create_agent() 配合 @tool / tool() 和 middleware 模式把 LangChain 打造成能上线的 agent,把外部工具、人工审批和错误处理串成可靠流程。需要构建生产级 agent、引入 human-in-the-loop 或统一异常/流控时用。特别要求以 create_agent() 为标准做法,便于维护和扩展,避免使用过时方案。

▸ 展开 SKILL.md 英文原文

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

开发编程Agent构建中间件工具定义通用
1.1k
Stars
85
Forks
22
仓库内 Skill
积累中
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/langchain-ai/langchain-skills/main/config/skills/langchain-fundamentals/SKILL.md
或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/langchain-ai/langchain-skills/main/config/skills/langchain-fundamentals/SKILL.md"
SKILL.MD 节选查看完整文件 ↗
<oneliner>
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.
</oneliner>

<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` / `
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有