| 项目 | 定义方式 | Schema 生成 | 验证 | 类型 |
|---|---|---|---|---|
| Aider | 无传统工具——用文本格式 | N/A | Regex 解析 | 文本解析 |
| SWE-agent | YAML action templates | 手动定义 | Regex 匹配 | Shell |
| OpenHands | Python Action 类 | Pydantic | Pydantic | Function Calling |
| Codex CLI DEEP | Rust trait + DynamicToolSpec | JSON Schema + schemars | 自动 | Shell apply_patch update_plan MCP |
| AutoGPT | @command 装饰器 | 手动 JSON | 手动 | Function Calling |
| MetaGPT | Action 子类 | Pydantic | Pydantic | Code-as-Action |
| AutoGen | Python 函数 + 类型注解 | 自动生成 JSON Schema | Pydantic | Function Calling |
| CrewAI | @tool 装饰器 | 自动 + 手动 | Pydantic | Function Calling |
| LangGraph | ToolNode + LangChain Tools | 自动 | Pydantic | Function Calling |
| PydanticAI | @agent.tool 装饰器 | 从类型注解自动 | Pydantic 严格验证 | Function Calling |
| Agno | Toolkit 类 + @tool | 自动 | Pydantic | Function Calling |
| Google ADK | FunctionTool / AgentTool | 自动 | Pydantic | Function Calling |
| Smolagents | Tool 子类 + @tool | 自动 | JSON Schema | Code-as-Action |
| Browser Use | Controller actions | 手动 | 手动 | 结构化文本 |
| GPT Researcher | Retriever 抽象 | 手动 | 手动 | Function Calling |
| Goose DEEP | Rust MCP 工具 + ACP | JSON Schema (rmcp) | 自动 (PermissionJudge) | Extension(≤5/≤50) ACP Subagent |
使用 LLM 的 function calling / tool_use API。工具定义为 JSON Schema,模型返回结构化的 tool_call,运行时解析执行。
# AutoGen 示例
@agent.tool
async def search(query: str, max_results: int = 5) -> str:
"""Search the web for information."""
return web_search(query, max_results)
优势: 标准化、可靠解析、类型安全
劣势: 依赖模型支持、工具数量受限
模型生成可执行代码(Python),运行时直接执行。工具通过代码调用。
# Smolagents CodeAgent 示例
# Model generates:
final_answer(search(query="latest AI news", max_results=5))
优势: 灵活性极高、可组合工具、无限表达力
劣势: 安全风险、需要沙箱、错误处理难
模型输出自由文本,运行时用 regex/格式化规则解析出动作。
# Aider 示例 - 模型输出:
Here's the change:
```python
foo.py
<<<<<<< SEARCH
old_code
=======
new_code
>>>>>>> REPLACE
```
优势: 不依赖 function calling API、模型兼容性广
劣势: 解析脆弱、格式漂移、复杂工具难支持
| 项目 | 执行环境 | 审批机制 | 网络隔离 | 文件系统隔离 |
|---|---|---|---|---|
| OpenHands | Docker Sandbox | ❌ (auto) | ✅ | ✅ |
| Codex CLI | Landlock + Seccomp + Network NS | ✅ Guardian 风险评估 | ✅ (on-request/never/on-failure) | ✅ |
| SWE-agent | Docker | ❌ | ✅ | ✅ |
| Aider | 本地 (无沙箱) | ❌ | ❌ | ❌ |
| AutoGPT | 本地/Docker | ⚠️ (user approval) | 可选 | 可选 |
| Smolagents | LocalPythonExecutor | ❌ | ❌ | ❌ |
| PydanticAI | 本地 | ❌ | ❌ | ❌ |