Smolagents
@huggingface
About Smolagents
🤗 smolagents: a barebones library for agents that think in code.
Overview
What is Smolagents?
Smolagents is a Python library for building and running powerful AI agents that think in code. It is designed for developers who want to create agentic workflows with minimal code, and it runs on any Python environment.
How to use Smolagents?
Install with pip install smolagents[toolkit]. Create an agent by specifying a model (e.g., InferenceClientModel) and tools (e.g., WebSearchTool). Run tasks with agent.run(). Additionally, use the smolagent or webagent CLI commands for quick execution from the command line.
Key features of Smolagents
- Core agent logic in under 1,000 lines of code
- Code Agents that write actions as Python code snippets
- Sandboxed execution via E2B or Docker for security
- Share and pull tools or agents to/from the Hugging Face Hub
- Model-agnostic: supports local transformers, Ollama, LiteLLM, OpenAI, and more
- Tool-agnostic: integrates with MCP servers, LangChain, and Hub Spaces
Use cases of Smolagents
- Automate multi-step web research and data collection
- Plan complex itineraries (e.g., a trip across multiple cities)
- Build web-browsing agents that navigate and extract information from sites
- Run any multi-step reasoning task using code generation and execution
FAQ from Smolagents
What makes Smolagents different from other agent frameworks?
Smolagents prioritizes simplicity with a core of about 1,000 lines, minimal abstractions, and first-class support for code-driven agents, which reduces the number of steps needed compared to JSON-based tool calling.
Which models and platforms does Smolagents support?
It supports any LLM: local transformers models, Ollama, any Hugging Face inference provider, OpenAI, Anthropic, Azure, Amazon Bedrock, and many more via its LiteLLM integration.
Can I use tools from MCP servers with Smolagents?
Yes, you can use tools from any MCP server, as well as from LangChain and Hugging Face Spaces.
What is the license and pricing for Smolagents?
Smolagents is open-source under the Apache License 2.0, with no usage restrictions or pricing.
How does Smolagents handle security for code execution?
Code execution can be sandboxed using E2B or Docker to isolate it from your own system, or run with a secure Python interpreter for reduced risk.
Basic information
More Agent Frameworks MCP clients
MCP REST API and CLI Client
rakesh-eltropy🚀 MCPOmni Connect - Universal Gateway to MCP Servers
Abiorh001MCPOmni Connect is an agent execution runtime that connects to multiple MCP servers via stdio, SSE, or streamable HTTP. It supports chat, autonomous agents, and planner-based orchestration treating each MCP server as a tool agent to enable dynamic multi-agent workflows across LLM
Evo AI - AI Agents Platform
evolutionapiEvo AI is an open-source platform for creating and managing AI agents, enabling integration with different AI models and services.
LangChain.js MCP Adapters
langchain-ai** THIS REPO HAS MOVED TO
Hermes MCP
cloudwalkElixir Model Context Protocol (MCP) SDK
Comments