跳到内容

Agent Framework

huggingface/smolagents

huggingface/smolagents· Python

让 LLM 直接写 Python 代码作为 action 的极简 agent 框架。

GitHub 数据

Stars
26,982
Forks
2,536
Watchers
131
Open issues
525

meta

License
Apache-2.0
主要语言
Python
最后 commit
2026-04-24
数据抓取时间
2026-04-29

HuggingFace 推出的轻量 agent 库,核心思路是 code agent:LLM 不输出 JSON tool call,而是直接写一段 Python 调用你注册的工具,在 sandbox(本地或 E2B)里执行后把结果喂回去。内置 `CodeAgent` 和 `ToolCallingAgent`,支持 HF Inference、Transformers、Ollama、LiteLLM 以及任意 OpenAI 兼容端点。`pip install smolagents` 即可,适合想完整读懂源码的开发者。

编辑试用心得

想要一个小到一下午能读完并 fork 的 agent loop,或者在跑本地 / 开源权重模型时,选它就对了——code-as-action 对小模型的工具调用稳定度提升明显。代价是你得信任(或 sandbox)生成的 Python,生态也比 LangGraph 单薄。需要 durable execution、复杂多 agent 编排或内置 observability 时,改用 LangGraph 或 Pydantic AI 更实在。

最后更新: 2026-04-29

We use cookies

Anonymous analytics help us improve the site. You can opt out anytime. Learn more

huggingface/smolagents · BuilderWorld