เฟรมเวิร์ก · Hugging Face
ภาพรวม smolagents
ไลบรารี Python ขนาดเล็กของ Hugging Face มีโค้ดประมาณหนึ่งพันบรรทัด โดย CodeAgent เขียนการทำงานเป็นโค้ด Python ซึ่งรันใน sandbox อย่าง Modal, E2B หรือ Docker และแชร์ agent กับ tools บน Hub ได้
เหมาะสำหรับ: การเรียนรู้และการวิจัย โดยเฉพาะ agent ที่ทำงานด้วยการเขียนโค้ด
ข้อมูลสำคัญ
- ผู้ดูแล
- Hugging Face
- ภาษา
- Python
- ไลเซนส์
- Apache-2.0
- เวอร์ชันล่าสุด
1.26.0· 29 พฤษภาคม 2569- Repository
- huggingface/smolagents
- ตัวเลือกแบบโฮสต์
- ไม่มี
Quickstart
ติดตั้งแพ็กเกจ ตั้งค่าข้อมูลรับรอง แล้วเรียกใช้ agent ตัวอย่างที่เล็กที่สุดจากเอกสารทางการ Model ID เป็นค่าที่เอกสารใช้ และอาจยังไม่ได้เปิดใช้งานในบัญชีของคุณ
pip install 'smolagents[toolkit]'from smolagents import CodeAgent, InferenceClientModel
# Initialize a model (using Hugging Face Inference API)
model = InferenceClientModel() # Uses a default model
# Create an agent with no tools
agent = CodeAgent(tools=[], model=model)
# Run the agent with a task
result = agent.run("Calculate the sum of numbers from 1 to 10")
print(result)ฟีเจอร์
| ใช้ได้กับทุกโมเดล | ใช่ | HF Inference Providers, LiteLLM, Transformers ที่รันในเครื่อง และ Ollama |
|---|---|---|
| MCP client | ใช่ | ใช้ tools จาก MCP server ใดก็ได้, LangChain หรือ Hub Spaces |
| MCP server | ยังไม่ยืนยัน | |
| หลาย agent | ใช่ | agent สามารถควบคุมการทำงานของ agent อื่นได้ |
| การทำงานต่อเนื่องแบบทนทาน | ยังไม่ยืนยัน | |
| การอนุมัติโดยมนุษย์ | ยังไม่ยืนยัน | |
| Tracing | ยังไม่ยืนยัน | |
| Evals | ไม่ |
การเปลี่ยนแปลงล่าสุด
- ไม่มีรุ่นบน PyPI หลัง 1.26.0 ซึ่งเผยแพร่เมื่อ 29 May 2026 แต่ยังมี commit ใน repo ช่วงปลาย September 2026