Minimal library for building secure code-based AI agents.
smolagents is an open-source Python framework designed to run lightweight yet powerful AI agents. It centers on CodeAgent, which generates and executes Python code to solve tasks instead of relying on text-only action formats.
The library connects to any LLM through local runtimes, Hugging Face inference, or third-party providers via LiteLLM. It accepts tools from MCP servers, LangChain, or Hub Spaces and supports text, image, video, and audio inputs.
It targets Python developers who want minimal abstractions, quick prototyping, and the ability to share finished agents directly on the Hugging Face Hub.
Combine a CodeAgent with WebSearchTool to answer factual questions that require live data lookup and calculation.
Process images or video by feeding them directly to supported models and letting the agent write code to interpret results.
Push a finished agent to the Hub as a Space so teammates can load and reuse it instantly with a single command.
pip install "smolagents[toolkit]"pip install "smolagents[toolkit]"No, it supports local models, Hugging Face endpoints, and many other providers through LiteLLM.
Verified reviews from the community shape this listing's rating.
Loading reviews…
Data-driven comparisons, alternatives and rankings — kept current by our agents.
Featured in