by Hugging Face
smolagents is a Python library from Hugging Face for building agents that write their actions as code. The core logic fits in roughly 1,000 lines.
APIFree
Step 1: Install the package with pip install "smolagents[toolkit]".
Step 2: Create a model object, such as InferenceClientModel, or switch to a LiteLLM, OpenAI-compatible, Transformers, Azure or Bedrock model.
Step 3: Build a CodeAgent with the tools it needs, for example WebSearchTool.
Step 4: Call agent.run with your task.
Step 5: Run untrusted agent code in a sandbox such as E2B, Modal, Blaxel or Docker.
Step 6: Optionally run the smolagent command for an interactive setup wizard, or share the agent with push_to_hub.
It is the library's main agent type. The model writes its actions as Python code snippets, and tool calls are executed as Python function calls.
Any LLM. The README lists local transformers and ollama models, providers on the Hub, and models from OpenAI, Anthropic and others through LiteLLM.
The README says to run agent code in a sandbox. The built-in LocalPythonExecutor applies some restrictions but is not a security boundary.
Yes. The smolagent command runs a multi-step CodeAgent, and webagent runs a web-browsing agent built on helium.
E2BE2B gives every AI agent its own isolated cloud machine, a microVM sandbox where it can run code, browse and use tools. It runs in E2B's cloud or in your own AWS, GCP or Azure account.
machine0machine0 provides persistent cloud virtual machines built for AI agents, managed through a CLI with JSON output or a remote MCP server. VMs are billed by the minute and can be suspended and resumed.
Semantic KernelSemantic Kernel is an AI-focused api for developer tools workflows, giving users practical model-powered capabilities through a dedicated product or developer interface.