代理脚手架

人工智能 社区

技能解读

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

LangGraph:langgraph 新

langgraph-cli 提供了多个模板。用langgraph new --help列出它们。常见选择: react-agent — 带工具的单法学硕士循环。最常见的起点。 retrieval-agent——向量存储上的RAG。 memory-agent — 使用 LangGraph 存储的长期记忆。 data-enrichment-agent — 结构化数据提取。

DeepAgents:直接写入文件

没有deepagents new。手动创建项目:固定楼层很重要:deepagents>=0.5删除了旧的子代理 API 并添加了异步子代理; 0.5.2添加了文件系统权限系统; 0.5.3 使 model=None 成为已弃用的 kwarg(您必须传递显式模型),并为子代理响应添加了结构化输出。然后agent/__init__.py(空)和agent/agent.py:加上一个pyproject.toml(或requirements.txt)和一个.env以及ANTHROPIC_API_KEY和LANGSMITH_*。这就是整个项目。

LCEL链:直接写入文件

对于非代理流(RAG、汇总、分类):然后agent/agent.py:对于RAG,请参阅langchain-agents-langchain-code技能。

值得遵循的命名约定(不强制执行)

这些是约定,而不是要求。它们使后续工作变得更容易,因为该捆绑包中的所有其他技能都假设它们:可运行的工件被命名为 agent 并位于 agent/agent.py。提供商密钥和LANGSMITH_*进入.env。提交一个.env.example。评估集位于evals/datasets/*.jsonl下; evals/run.py 的评估运行程序。 FastAPI 主机(如果 Docker/Cloud Run 部署需要)位于server/app.py。

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

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

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

# Scaffolding LangChain ecosystem projects

There is no single scaffolder that covers all three project shapes. Pick the right path:

| Project shape | Scaffolder |
|---|---|
| LangGraph agent (explicit StateGraph) | `langgraph new` (from `langgraph-cli`) |
| DeepAgents agent (planning + sub-agents + virtual FS) | No scaffolder — write ~15 lines yourself (recipe below) |
| LCEL pipeline (chains, RAG, classification) | No scaffolder — write ~10 lines yourself (recipe below) |

## LangGraph: `langgraph new`

```bash
pip install "langgraph-cli>=0.4"    # if not installed
langgraph new my-agent --template react-agent
cd my-agent
pip install -e .
```

`langgraph-cli` ships several templates. List them with `langgraph new --help`. Common picks:
- `react-agent` — single-LLM-with-tools loop. The most common starting point.
- `retrieval-agent` — RAG over a vector store.
- `memory-agent` — long-term memory using the LangGraph store.
- `data-enrichment-agent` — structured data extraction.

Each template ships its own `pyproject.toml`, `langgraph.json`, and `src/<package>/graph.py` — read those after scaffolding to learn the layout. **Do not assume the layout matches across templates.** The conventions vary.

## DeepAgents: write the file directly

There's no `deepagents new`. Create the project by hand:

```bash
mkdir my-deep-agent && cd my-deep-agent
python -m venv .venv && source .venv/bin/activate
pip install \
  "deepagents>=0.5.3" \
  "langchain>=1.2" \
  "langchain-anthropic>=1.4" \
  "langsmith>=0.7"
mkdir agent
```

Pin floors matter: `deepagents>=0.5` removed the legacy subagents API and added async sub-agents; `0.5.2` added the filesystem permissions system; `0.5.3` made `model=None` a deprecated kwarg (you must pass an explicit model) and added structured outputs for sub-agent responses.

Then `agent/__init__.py` (empty) and `agent/agent.py`:

```python
"""DeepAgent for my-deep-agent. Always exported as `agent`."""
from deepagents import create_deep_agent
from langchain.chat_models import init_chat_model

SYSTEM_PROMPT = "You are my-deep-agent, a helpful agent."

TOOLS = []          # add user tools here
SUBAGENTS = []      # add sub-agents here (see deepagents-code skill)

agent = create_deep_agent(
    model=init_chat_model("anthropic:claude-sonnet-4-6"),  # explicit model required as of 0.5.3
    tools=TOOLS,
    subagents=SUBAGENTS,
    instructions=SYSTEM_PROMPT,
)
```

Plus a `pyproject.toml` (or `requirements.txt`) and a `.env` with `ANTHROPIC_API_KEY` and `LANGSMITH_*`. That's the whole project.

For deploy: DeepAgents' `create_deep_agent` returns a compiled LangGraph, so a `langgraph.json` pointing at `agent.agent:agent` works for `langgraph dev` and `langgraph build/deploy`.

## LCEL chains: write the file directly

For non-agentic flows (RAG, summarization, classification):

```bash
mkdir my-chain && cd my-chain
python -m venv .venv && source .venv/bin/activate
pip install "langchain>=1.2" "langchain-openai>=1.0" "langsmith>=0.7"
mkdir agent
```

Then `agent/agent.py`:

```python
"""LCEL chain. Exposed as `agent` (a Runnable)."""
from langchain.chat_models import init_chat_model
from langchain_core.messages import HumanMessage, SystemMessage
from langchain_core.runnables import RunnableLambda

SYSTEM_PROMPT = "You are a helpful assistant."

def _to_messages(payload: dict) -> list:
    msgs = [SystemMessage(content=SYSTEM_PROMPT)]
    for m in payload.get("messages", []):
        msgs.append(HumanMessage(content=m["content"]))
    return msgs

agent = RunnableLambda(_to_messages) | init_chat_model("openai:gpt-4o-mini")
```

For RAG, see the `langchain-agents-langchain-code` skill.

## Naming conventions worth following (not enforced)

These are conventions, not requirements. They make follow-up work easier because every other skill in this bundle assumes them:

- The runnable artifact is named `agent` and lives at `agent/agent.py`.
- Provider keys and `LANGSMITH_*` go in `.env`. Commit a `.env.example`.
- Evalsets live under `evals/datasets/*.jsonl`; the eval runner at `evals/run.py`.
- A FastAPI host (if needed for Docker/Cloud Run deploy) lives at `server/app.py`.

Skills that follow assume these names. If the project diverges, adapt — these are not hard rules, just the path of least resistance.

---
> 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 即可参与讨论、点赞、订阅更新。