skillfed

smolagents

🤗 smolagents: a barebones library for agents. Agents write python code to call tools or orchestrate other agents.

smolagents v1.26.0 626.8K downloads/30d#5,687 on PyPI
License unclear Active released

What it is and what it does

smolagents is a lightweight agent framework that lets you build autonomous agents in a few lines of code. Unlike traditional agents that generate tool-call descriptions, smolagents agents write actual Python code to invoke tools and coordinate multi-step workflows. The library is model-agnostic—it works with local transformers, Ollama, OpenAI, Anthropic, and many other providers via LiteLLM or Hugging Face's inference API. It also supports multiple modalities (text, vision, video, audio) and can pull tools from MCP servers, LangChain, or Hugging Face Spaces.

The core agent type, CodeAgent, follows a ReAct loop: it receives a task, generates Python code snippets that call tools as functions, executes that code, stores the results in memory, and repeats until it calls a final_answer function. For security, you can run agents in sandboxed environments. The library integrates with Hugging Face Hub for sharing agents and tools as Space repositories, making it easy to collaborate and reuse agent configurations.

Use it for:

  • Build a multi-step research agent that searches the web, extracts information, and synthesizes answers without manual orchestration.
  • Create a vision-enabled agent that browses websites, clicks elements, and extracts product details or prices from e-commerce sites.
  • Share reusable agents and tool collections on Hugging Face Hub for team collaboration and instant deployment.
  • Run agents locally with transformers or connect to any LLM provider (OpenAI, Anthropic, Together AI) by changing one configuration.
  • Orchestrate complex workflows where agents coordinate with other agents or call specialized tools from MCP servers.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

smolagents lets you build and run AI agents that write Python code to call tools and orchestrate other agents, with support for multiple LLM providers and sandboxed execution.

Yes, if you want to build code-writing agents with minimal boilerplate and flexibility across LLM providers. The low install friction, active maintenance, and zero known vulnerabilities make it safe to try. The young release history (first release 2024-12-27) means the API may evolve, but the design is intentionally minimal. Start with the quick demo to verify it fits your use case.

Install

smolagents on PyPI

pip

pip install smolagents

uv

uv add smolagents

poetry

poetry add smolagents

Installing smolagents

Before you install

Low install friction with a pure-Python wheel and six common runtime dependencies. Active maintenance with a recent release (77 days ago), though the project is young (first release 2024-12-27).

Quickstart

pip install 'smolagents[toolkit]'

from smolagents import CodeAgent, WebSearchTool, InferenceClientModel

model = InferenceClientModel()
agent = CodeAgent(tools=[WebSearchTool()], model=model)
agent.run("How many seconds would it take for a leopard at full speed to run through Pont des Arts?")

Requires Python >= 3.10. Sandboxed execution backends (Blaxel, E2B, Modal, Docker) may require additional setup or API keys.

Verify before relying

  • Whether the sandboxed execution backends (Blaxel, E2B, Modal, Docker) are included or require separate installation.
  • Performance characteristics and latency for typical multi-step agent workflows.
  • Whether the library's ~1,000 lines of code claim remains accurate at version 1.26.0.

Package facts

License not declared (unclear)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 6 — huggingface-hub, requests, rich, jinja2, pillow, python-dotenv
Maintenance actively maintained — 77 days since the last release
First released
Downloads 626,778/month — #5,687 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: smolagents-1.26.0-py3-none-any.whl

Tags

code-writing agentsLLM agent frameworktool-calling agentsmulti-step AI orchestrationsandboxed agent executionhuggingface agent libraryReAct agents with code
agent-frameworkllm-orchestrationcode-execution

More Artificial Intelligence packages

litellm

LiteLLM provides a unified Python interface to…

permissive · top 100 on PyPI

huggingface-hub

Client library and CLI tool for downloading,…

permissive · top 100 on PyPI

langchain

LangChain provides a framework for building…

permissive · top 1,000 on PyPI

hf-xet

hf-xet provides chunk-based deduplication and…

permissive · top 1,000 on PyPI

tokenizers

Tokenizers converts raw text into token…

permissive · top 1,000 on PyPI

transformers

Transformers provides a unified framework for…

permissive · top 1,000 on PyPI

openai-agents

A framework for building multi-agent LLM…

permissive · top 1,000 on PyPI

mcpadapt

Adapts MCP (Model Context Protocol) servers…

permissive · top 15,000 on PyPI

strands-agents

Strands Agents is a Python SDK for building AI…

permissive · top 1,000 on PyPI

praisonaiagents

PraisonAI agents is a Python framework for…

unclear · top 15,000 on PyPI

agentops

AgentOps provides observability and monitoring…

permissive · top 15,000 on PyPI

agent-framework-core

Build, orchestrate, and deploy AI agents and…

permissive · top 5,000 on PyPI

agentscope

AgentScope is a production-ready framework for…

permissive · top 15,000 on PyPI

qwen-agent

Qwen-Agent is a framework for building LLM…

unclear · top 15,000 on PyPI

baml-py

baml-py is the Python runtime for executing…

unclear · top 15,000 on PyPI

stirrup

Stirrup is a lightweight Python framework for…

permissive · top 15,000 on PyPI

Further reading