代理工作流程

运维部署 社区

技能解读

当前原文的自动摘译,尚未人工审校。

该捆绑包假定的版本底数

langchain >= 1.2(v1 系列 - 中间件优先create_agent)langgraph >= 1.1、langgraph-cli >= 0.4``deepagents >= 0.5.3(异步子代理、结构化子代理响应、文件系统权限;model=None已弃用)langsmith >= 0.7(pytest 插件 + 新评估器 API) langchain-anthropic >= 1.4、langchain-openai >= 1.0

您有两个互补的工具

该技能包与mcpdoc MCP 服务器配对。两者的角色截然不同;两者都用。 mcpdoc(MCP 服务器) · 此技能包目的 · 实时 API 参考 · 有观点的剧本内容 · docs.langchain.com 现在有什么内容 · 如何思考 LangChain 项目 何时使用 · “SummarizationMiddleware 的签名是什么?” /“create_agent需要什么kwargs?” /“X 的导入路径是什么?” ·“什么是生产中间件堆栈?” /“如何将 Cloud Run + Secret Manager + Postgres 检查点连接在一起?” /“代理人通常会犯哪些错误?”

何时加载哪个技能

目标 · 技能 开始一个新的代理项目 · langchain-agents-scaffold 构建一个现代代理(大多数情况) · langchain-agents-middleware ← 首先;将 create_agent(...) 与中间件结合使用 将节点/边/工具添加到自定义 LangGraph · langchain-agents-langgraph-code 自定义 DeepAgent · langchain-agents-deepagents-code

心智模型

现代堆栈中的三层: create_agent(model, tools, middleware=...) - 构建代理的 v1 默认值。中间件是您添加重试、回退、摘要、HITL、PII 处理、调用限制的方式。阅读生产堆栈的中间件技能。 Raw LangGraph (StateGraph) — 当create_agent不够时下拉(多图工作流程、自定义状态、并行分支)。阅读 langgraph 代码。

按生命周期阶段划分的常用命令

阶段 · 命令 搭建 LangGraph 项目 · langgraph new my-agent --template react-agent 搭建 DeepAgent / 链 · 没有搭建器 - 编写一个小的 agent.py (参见搭建技巧) 安装 deps · pip install -e . 或 uv sync 在图上迭代 · langgraph dev

流狐档案 运行与权限由流狐静态检查推断,不代表作者声明或实际测试结果。
领域
运维部署
作者声明的智能体
未找到明确声明;不据此推断已兼容或已测试
静态检查
88 / 100 · 启发式扫描,不代表运行安全
运行环境证据
未执行;当前没有隔离运行测试证据
作者 / 版本 / 许可证
@tomevault-io · 未声明许可证
上下文用量评级
低消耗
接入复杂程度
需手动接入
是否需要外部接口密钥
需要 · OpenAI / Anthropic
兼容的系统
Docker
运行环境要求
Python · Docker
检测到的文件与系统行为
  • 只读
  • 允许写入 / 修改
  • 读取环境变量
网络行为
允许外网请求
安装命令数
无(仅作为资料)

需要注意: 未声明工具权限范围;实际权限由运行环境决定。

作者说明文件(原文) SKILL.md

# LangChain Agents Workflow

This skill is the entry point — read it first, then load the more specific skill for the step you're on.

## Version floors this bundle assumes

- `langchain >= 1.2` (v1 series — middleware-first `create_agent`)
- `langgraph >= 1.1`, `langgraph-cli >= 0.4`
- `deepagents >= 0.5.3` (async sub-agents, structured sub-agent responses, filesystem permissions; `model=None` deprecated)
- `langsmith >= 0.7` (pytest plugin + new evaluator API)
- `langchain-anthropic >= 1.4`, `langchain-openai >= 1.0`

If a project pins anything below these floors, suggest the bump before writing code — the API shapes in this bundle assume the v1+ surface.

## You have two complementary tools

This skill bundle pairs with the **`mcpdoc` MCP server**. The two have distinct roles; use both.

| | `mcpdoc` (MCP server) | This skill bundle |
|---|---|---|
| Purpose | Live API reference | Opinionated playbook |
| Content | Whatever's on `docs.langchain.com` right now | How to *think* about LangChain projects |
| When to use | "What's the signature of `SummarizationMiddleware`?" / "What kwargs does `create_agent` take?" / "What import path for X?" | "What's the production middleware stack?" / "How do I wire Cloud Run + Secret Manager + Postgres checkpointer together?" / "Which mistakes does an agent typically make here?" |
| How to use | Call `fetch_docs(url)` or `list_doc_sources()` | Load skills based on description triggers |
| Drift risk | Zero — always live | Owner updates as ecosystem evolves; some rot tolerated |

**Rule of thumb:** when you need an exact API detail, fetch from `mcpdoc`. When you need to make a design decision, load a skill. When in doubt, do both.

## When to load which skill

| Goal | Skill |
|---|---|
| Start a new agent project | `langchain-agents-scaffold` |
| Build a modern agent (most cases) | `langchain-agents-middleware` ← first; uses `create_agent(...)` with middleware |
| Add nodes/edges/tools to a custom LangGraph | `langchain-agents-langgraph-code` |
| Customize a DeepAgent | `langchain-agents-deepagents-code` |
| Build a non-agentic LCEL pipeline (chains, RAG) | `langchain-agents-langchain-code` |
| Write or run evals; unit/integration test agents | `langchain-agents-langsmith-evals` |
| Deploy + productionise | `langchain-agents-deploy` |
| Debug / read traces / OTEL | `langchain-agents-observability` |

## Mental model

Three layers in the modern stack:

1. **`create_agent(model, tools, middleware=...)`** — the v1 default for building agents. Middleware is how you add retries, fallbacks, summarization, HITL, PII handling, call limits. Read the **middleware** skill for the production stack.
2. **Raw LangGraph (`StateGraph`)** — drop down when `create_agent` isn't enough (multi-graph workflows, custom state, parallel branches). Read **langgraph-code**.
3. **DeepAgents** — `create_deep_agent(...)` is `create_agent(...)` pre-loaded with `FilesystemMiddleware` + `SubAgentMiddleware` + `TodoListMiddleware`. Read **deepagents-code**.

For non-agentic flows (RAG, classification), use plain LCEL chains — middleware does **not** apply to chains.

## Common commands by lifecycle stage

| Stage | Command(s) |
|---|---|
| Scaffold a LangGraph project | `langgraph new my-agent --template react-agent` |
| Scaffold a DeepAgent / chain | No scaffolder — write a small `agent.py` (see scaffold skill) |
| Install deps | `pip install -e .` or `uv sync` |
| Iterate on a graph | `langgraph dev` |
| Run an agent ad hoc | `python -c "from agent.agent import agent; print(agent.invoke({'messages': [...] }))"` |
| Run evals | `python evals/run.py` |
| Unit-test agents (no API calls) | `pytest` with `LLMToolEmulator` middleware |
| Deploy to LangSmith Cloud | `langgraph build -t my-agent && langgraph deploy` |
| Deploy to Cloud Run | `gcloud run deploy my-agent --source .` |
| Deploy as a Docker image | `docker build && docker run --env-file .env` |

## Hard rules

- **Look up exact APIs via `mcpdoc`, don't guess.** If `mcpdoc` isn't configured, ask the user to set it up (see this repo's README) before you write LangChain code.
- **Always check what's already installed before suggesting `pip install`** — `pip show langchain langgraph deepagents langsmith`.
- **Never print `.env` contents** — refer to keys by name only.
- **For ANY production agent, add the production middleware stack** (call limits, retries, fallback, summarization). Copy-paste-ready in the middleware skill.
- **Run smoke evals before any deploy.** Not enforced — you must do it.
- **Read the project structure first** (`ls`, `tree -L 2`) before assuming layout.

## Required environment variables (most projects)

- `LANGSMITH_API_KEY` — for tracing and evals.
- `LANGSMITH_TRACING=true` — enables trace capture.
- `LANGSMITH_PROJECT` — trace bucket name.
- One of `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, etc.

If any are missing when needed, fail fast with a clear message that names the missing variable.

---
> Source: [cwijayasundara/agent_cli_langchain](https://github.com/cwijayasundara/agent_cli_langchain) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-05-23 -->

讨论

基于 GitHub Discussions。登录 GitHub 即可参与讨论、点赞、订阅更新。