smolagents
ActiveDescription
smolagents is a lightweight agent framework from Hugging Face for quickly building tool-using LLM agents.
Key Features
- Code-generating agent — CodeAgent writes and executes Python code directly as tool calls, not JSON
- Sandboxed execution — Secure code running via Blaxel, E2B, Modal, Docker sandboxes
- Hub integration — One-click share/pull agents and tools from Hugging Face Hub
- Model-agnostic architecture — Supports 100+ models including transformers, Ollama, OpenAI, Anthropic
- Multi-modal support — Agents handle text, vision, video, and audio inputs
- CLI tools — smolagent and webagent commands to run agents directly from terminal
Use Cases
Tags
Categories
Quick Start
pip install "smolagents[toolkit]"
```python
from smolagents import CodeAgent, WebSearchTool, InferenceClientModel
model = InferenceClientModel()
agent = CodeAgent(tools=[WebSearchTool()], model=model, stream_outputs=True)
agent.run("How many seconds would it take for a leopard at full speed to run through Pont des Arts?")
```