Hugging Face's minimalist agent framework — build code-writing agents in a few hundred lines of Python, with first-class support for open models.
Hugging Face's minimalist agent framework — build code-writing agents in a few hundred lines of Python, with first-class support for open models.
smolagents is Hugging Face's small, opinionated agent framework designed to be the antidote to sprawling frameworks like LangChain. The entire library is around a thousand lines of Python you can actually read in one sitting. The core idea is 'code-writing agents': instead of the standard tool-calling loop where an LLM emits JSON that a runtime dispatches, smolagents has the model write and execute Python code that calls its tools directly. In practice this is dramatically more expressive — an agent can loop, branch, do arithmetic, chain tools in one step — and it maps well to what modern LLMs are actually best at (coding). The framework offers two execution paths: a locally sandboxed Python interpreter and E2B or Docker-backed remote sandboxes for untrusted code. Model support is broad: OpenAI, Anthropic, Google Gemini, any Hugging Face Inference or Transformers model, LiteLLM, Bedrock, and Ollama. Tools include a built-in web browser, DuckDuckGo/Google search, Python REPL, image generation, and any function decorated with @tool. smolagents is Model Context Protocol compatible on both sides — you can use an MCP server as a tool source, and you can expose a smolagents agent through an MCP endpoint. Because it favors open-weight models (via HF Transformers and Inference) as first-class citizens rather than an afterthought, smolagents is popular for research, education, and cost-sensitive production agents.
Agent type focused on using code-like steps to accomplish tasks, giving developers a more inspectable way to understand and debug agent behavior.
Use Case:
Building a data analysis agent where the developer wants to review the agent's steps and adapt the workflow.
Developer-oriented tool definition for connecting agent behavior to Python functions and utilities supplied by the application team.
Use Case:
Turning an existing Python utility function into an agent-accessible tool within a code-first workflow.
smolagents documentation describes managed-agent patterns for composing agents, which is the better-supported framing than treating the library as a full multi-agent operations platform.
Use Case:
Building a research workflow where separate agent components or tool-driven steps handle retrieval, summarization, and review.
Maintained under the Hugging Face organization on GitHub, making it part of a familiar open-source AI ecosystem for many Python developers.
Use Case:
Using smolagents in a team that already evaluates or builds with Hugging Face-adjacent tooling.
The code-thinking design is useful for teams that want agent behavior to remain inspectable during development and debugging.
Use Case:
Reviewing an agent's intermediate steps when investigating an unexpected answer or tool action.
Designed as a developer library rather than a single hosted product, allowing teams to connect models and tools according to their application needs.
Use Case:
Testing an agent prototype while keeping model and tooling choices under engineering control.
Free
Ready to get started with smolagents?
View Pricing Options →We believe in transparent reviews. Here's what smolagents doesn't handle well:
The supplied website content does not include a dated changelog or 2026-specific release notes. As of the provided listing, the most relevant current positioning is that smolagents is a Hugging Face GitHub project described as a barebones library for agents that think in code.
AI Agent Builders
The industry-standard framework for building production-ready LLM applications with comprehensive tool integration, agent orchestration, and enterprise observability through LangSmith.
AI Development
Leading multi-agent framework and platform for building, deploying, and monitoring collaborative AI agent teams.
AI Memory & Search
Build, run, and manage production-ready AI agents with a Python framework for agent systems, memory, tools, and AgentOS deployment.
Pricing and features change often. If anything on this smolagents page is wrong or missing, tell us and include a link to the source. We review every correction.