← Back to Library
Development Tools

smolagents

smolagents is Hugging Face's lightweight agentic framework that enables building robust AI agents in just a few lines of code. Unlike traditional tool-calling approaches, smolagents uses 'code agents' that write and execute Python code snippets to perform actions, achieving 30% reduction in steps and LLM calls with superior performance on complex benchmarks. With only ~1,000 lines of core logic, it provides first-class support for code-based reasoning while maintaining security through sandboxed execution via E2B, Modal, Docker, or Pyodide+Deno WebAssembly. Deep Hugging Face Hub integration enables easy tool sharing, and the framework supports any LLM provider including transformers, Ollama, OpenAI, Anthropic, and more via LiteLLM integration.

smolagents
agents llm huggingface code-agents multi-agent python